summaryrefslogtreecommitdiff
path: root/tools/aapt2/link/XmlReferenceLinker_test.cpp
diff options
context:
space:
mode:
authorBill Peckham <bpeckham@google.com>2018-09-08 10:06:40 -0700
committerBill Peckham <bpeckham@google.com>2018-09-08 10:06:40 -0700
commita74879d25eb0e4ef53855b57181b038bca75d05f (patch)
tree2a1ef83944343e547bebeae9998b098557225070 /tools/aapt2/link/XmlReferenceLinker_test.cpp
parentb00720941bf751117cf02da40add144683ab51f1 (diff)
Merge QP1A.180823.001
Change-Id: Ia2d6fa811b3c57185c1975db603d59e6eaef73fc
Diffstat (limited to 'tools/aapt2/link/XmlReferenceLinker_test.cpp')
-rw-r--r--tools/aapt2/link/XmlReferenceLinker_test.cpp43
1 files changed, 0 insertions, 43 deletions
diff --git a/tools/aapt2/link/XmlReferenceLinker_test.cpp b/tools/aapt2/link/XmlReferenceLinker_test.cpp
index d321f8f76d87..ef99355e5b5f 100644
--- a/tools/aapt2/link/XmlReferenceLinker_test.cpp
+++ b/tools/aapt2/link/XmlReferenceLinker_test.cpp
@@ -18,7 +18,6 @@
#include "test/Test.h"
-using ::testing::Eq;
using ::testing::IsNull;
using ::testing::NotNull;
@@ -71,29 +70,12 @@ class XmlReferenceLinkerTest : public ::testing::Test {
.Build())
.AddPublicSymbol("com.app.test:attr/attr", ResourceId(0x7f010002),
test::AttributeBuilder().Build())
- .AddPublicSymbol("com.app.lib:string/lib_string", ResourceId(0x7f020003))
.Build())
.Build();
-
- auto_namespace_context_ =
- test::ContextBuilder()
- .SetCompilationPackage("com.app.test")
- .SetNameManglerPolicy(NameManglerPolicy{"com.app.test", {"com.android.support"}})
- .SetAutoNamespace(true)
- .AddSymbolSource(
- test::StaticSymbolSourceBuilder()
- .AddPublicSymbol("android:attr/text", ResourceId(0x01010003),
- test::AttributeBuilder()
- .SetTypeMask(android::ResTable_map::TYPE_STRING)
- .Build())
- .AddPublicSymbol("com.app.lib:string/lib_string", ResourceId(0x7f020003))
- .Build())
- .Build();
}
protected:
std::unique_ptr<IAaptContext> context_;
- std::unique_ptr<IAaptContext> auto_namespace_context_;
};
TEST_F(XmlReferenceLinkerTest, LinkBasicAttributes) {
@@ -213,31 +195,6 @@ TEST_F(XmlReferenceLinkerTest, LinkAutoResReference) {
EXPECT_EQ(make_value(ResourceId(0x7f020001)), ref->id);
}
-TEST_F(XmlReferenceLinkerTest, LinkAutoNamespaceResReference) {
- std::unique_ptr<xml::XmlResource> doc = test::BuildXmlDomForPackageName(context_.get(), R"(
- <View
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:text="@string/lib_string" />)");
-
- XmlReferenceLinker linker;
- // Should not link with auto-namespace support disabled.
- ASSERT_FALSE(linker.Consume(context_.get(), doc.get()));
- // Should link with auto-namespace enabled.
- ASSERT_TRUE(linker.Consume(auto_namespace_context_.get(), doc.get()));
-
- xml::Element* view_el = doc->root.get();
- ASSERT_THAT(view_el, NotNull());
-
- xml::Attribute* xml_attr = view_el->FindAttribute(xml::kSchemaAndroid, "text");
- ASSERT_THAT(xml_attr, NotNull());
- ASSERT_TRUE(xml_attr->compiled_attribute);
- EXPECT_EQ(make_value(ResourceId(0x01010003)), xml_attr->compiled_attribute.value().id);
- Reference* ref = ValueCast<Reference>(xml_attr->compiled_value.get());
- ASSERT_THAT(ref, NotNull());
- ASSERT_TRUE(ref->name);
- EXPECT_EQ(make_value(ResourceId(0x7f020003)), ref->id);
-}
-
TEST_F(XmlReferenceLinkerTest, LinkViewWithShadowedPackageAlias) {
std::unique_ptr<xml::XmlResource> doc = test::BuildXmlDomForPackageName(context_.get(), R"(
<View xmlns:app="http://schemas.android.com/apk/res/android" app:attr="@app:id/id">