diff options
Diffstat (limited to 'aidl_unittest.cpp')
-rw-r--r-- | aidl_unittest.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp index 22ad1bd..570ecc7 100644 --- a/aidl_unittest.cpp +++ b/aidl_unittest.cpp @@ -48,6 +48,11 @@ R"(place/for/output/p/IFoo.java : \ p/IFoo.aidl : )"; +const char kExpectedNinjaDepFileContents[] = +R"(place/for/output/p/IFoo.java : \ + p/IFoo.aidl +)"; + const char kExpectedParcelableDepFileContents[] = R"( : \ p/Foo.aidl @@ -393,6 +398,24 @@ TEST_F(AidlTest, WritesCorrectDependencyFile) { EXPECT_EQ(actual_dep_file_contents, kExpectedDepFileContents); } +TEST_F(AidlTest, WritesCorrectDependencyFileNinja) { + // While the in tree build system always gives us an output file name, + // other android tools take advantage of our ability to infer the intended + // file name. This test makes sure we handle this correctly. + JavaOptions options; + options.input_file_name_ = "p/IFoo.aidl"; + options.output_base_folder_ = "place/for/output"; + options.dep_file_name_ = "dep/file/path"; + options.dep_file_ninja_ = true; + io_delegate_.SetFileContents(options.input_file_name_, + "package p; interface IFoo {}"); + EXPECT_EQ(0, ::android::aidl::compile_aidl_to_java(options, io_delegate_)); + string actual_dep_file_contents; + EXPECT_TRUE(io_delegate_.GetWrittenContents(options.dep_file_name_, + &actual_dep_file_contents)); + EXPECT_EQ(actual_dep_file_contents, kExpectedNinjaDepFileContents); +} + TEST_F(AidlTest, WritesTrivialDependencyFileForParcelable) { // The SDK uses aidl to decide whether a .aidl file is a parcelable. It does // this by calling aidl with every .aidl file it finds, then parsing the |