diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-09-15 16:57:21 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-09-15 16:57:21 +0000 |
commit | e33de76a16f6acc42858766460976f44e629657d (patch) | |
tree | ce962def3f718730407e6863a14aaf0df9a66787 /tools/aapt2/java/ManifestClassGenerator_test.cpp | |
parent | d2d6c257f141ed38da2cf0d0a2f84c6f7f055e92 (diff) | |
parent | e02983681ae85212c2263055fd4bcfd8097f19bc (diff) |
Merge changes Id8bdb14e,I573a6735,Ia804777f,Ia68122cb,Ia1997800, ... into oc-mr1-dev
am: e02983681a
Change-Id: I42369e6fb7bd121e45b5a002cd5f00e05221ead3
Diffstat (limited to 'tools/aapt2/java/ManifestClassGenerator_test.cpp')
-rw-r--r-- | tools/aapt2/java/ManifestClassGenerator_test.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/aapt2/java/ManifestClassGenerator_test.cpp b/tools/aapt2/java/ManifestClassGenerator_test.cpp index 9f6ec210a6a7..44b6a1ffd5ae 100644 --- a/tools/aapt2/java/ManifestClassGenerator_test.cpp +++ b/tools/aapt2/java/ManifestClassGenerator_test.cpp @@ -112,6 +112,21 @@ TEST(ManifestClassGeneratorTest, CommentsAndAnnotationsArePresent) { EXPECT_THAT(actual, HasSubstr(expected_secret)); } +// This is bad but part of public API behaviour so we need to preserve it. +TEST(ManifestClassGeneratorTest, LastSeenPermissionWithSameLeafNameTakesPrecedence) { + std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build(); + std::unique_ptr<xml::XmlResource> manifest = test::BuildXmlDom(R"( + <manifest xmlns:android="http://schemas.android.com/apk/res/android"> + <permission android:name="android.permission.ACCESS_INTERNET" /> + <permission android:name="com.android.aapt.test.ACCESS_INTERNET" /> + </manifest>)"); + + std::string actual; + ASSERT_TRUE(GetManifestClassText(context.get(), manifest.get(), &actual)); + EXPECT_THAT(actual, HasSubstr("ACCESS_INTERNET=\"com.android.aapt.test.ACCESS_INTERNET\";")); + EXPECT_THAT(actual, Not(HasSubstr("ACCESS_INTERNET=\"android.permission.ACCESS_INTERNET\";"))); +} + static ::testing::AssertionResult GetManifestClassText(IAaptContext* context, xml::XmlResource* res, std::string* out_str) { std::unique_ptr<ClassDefinition> manifest_class = |