blob: 810f63c0410ef66eebe996cd36f8c8c5744ef4b9 [file] [log] [blame]
Adam Lesinski1ab598f2015-08-14 14:26:04 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "link/Linkers.h"
Adam Lesinskice5e56e22016-10-21 17:56:45 -070018
Adam Lesinski64587af2016-02-18 18:33:06 -080019#include "test/Test.h"
Adam Lesinski1ab598f2015-08-14 14:26:04 -070020
21namespace aapt {
22
23class XmlReferenceLinkerTest : public ::testing::Test {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070024 public:
25 void SetUp() override {
Adam Lesinskice5e56e22016-10-21 17:56:45 -070026 context_ =
Adam Lesinskicacb28f2016-10-19 12:18:14 -070027 test::ContextBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070028 .SetCompilationPackage("com.app.test")
29 .SetNameManglerPolicy(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070030 NameManglerPolicy{"com.app.test", {"com.android.support"}})
Adam Lesinskice5e56e22016-10-21 17:56:45 -070031 .AddSymbolSource(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070032 test::StaticSymbolSourceBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070033 .AddPublicSymbol(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070034 "android:attr/layout_width", ResourceId(0x01010000),
35 test::AttributeBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070036 .SetTypeMask(android::ResTable_map::TYPE_ENUM |
Adam Lesinskicacb28f2016-10-19 12:18:14 -070037 android::ResTable_map::TYPE_DIMENSION)
Adam Lesinskice5e56e22016-10-21 17:56:45 -070038 .AddItem("match_parent", 0xffffffff)
39 .Build())
40 .AddPublicSymbol(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070041 "android:attr/background", ResourceId(0x01010001),
42 test::AttributeBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070043 .SetTypeMask(android::ResTable_map::TYPE_COLOR)
44 .Build())
45 .AddPublicSymbol("android:attr/attr",
Adam Lesinskicacb28f2016-10-19 12:18:14 -070046 ResourceId(0x01010002),
Adam Lesinskice5e56e22016-10-21 17:56:45 -070047 test::AttributeBuilder().Build())
48 .AddPublicSymbol(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070049 "android:attr/text", ResourceId(0x01010003),
50 test::AttributeBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070051 .SetTypeMask(android::ResTable_map::TYPE_STRING)
52 .Build())
Adam Lesinski1ab598f2015-08-14 14:26:04 -070053
Adam Lesinskicacb28f2016-10-19 12:18:14 -070054 // Add one real symbol that was introduces in v21
Adam Lesinskice5e56e22016-10-21 17:56:45 -070055 .AddPublicSymbol("android:attr/colorAccent",
Adam Lesinskicacb28f2016-10-19 12:18:14 -070056 ResourceId(0x01010435),
Adam Lesinskice5e56e22016-10-21 17:56:45 -070057 test::AttributeBuilder().Build())
Adam Lesinski1ab598f2015-08-14 14:26:04 -070058
Adam Lesinskicacb28f2016-10-19 12:18:14 -070059 // Private symbol.
Adam Lesinskice5e56e22016-10-21 17:56:45 -070060 .AddSymbol("android:color/hidden", ResourceId(0x01020001))
Adam Lesinski467f1712015-11-16 17:35:44 -080061
Adam Lesinskice5e56e22016-10-21 17:56:45 -070062 .AddPublicSymbol("android:id/id", ResourceId(0x01030000))
63 .AddSymbol("com.app.test:id/id", ResourceId(0x7f030000))
64 .AddSymbol("com.app.test:color/green",
Adam Lesinskicacb28f2016-10-19 12:18:14 -070065 ResourceId(0x7f020000))
Adam Lesinskice5e56e22016-10-21 17:56:45 -070066 .AddSymbol("com.app.test:color/red", ResourceId(0x7f020001))
67 .AddSymbol(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070068 "com.app.test:attr/colorAccent", ResourceId(0x7f010000),
69 test::AttributeBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070070 .SetTypeMask(android::ResTable_map::TYPE_COLOR)
71 .Build())
72 .AddPublicSymbol(
Adam Lesinskicacb28f2016-10-19 12:18:14 -070073 "com.app.test:attr/com.android.support$colorAccent",
74 ResourceId(0x7f010001),
75 test::AttributeBuilder()
Adam Lesinskice5e56e22016-10-21 17:56:45 -070076 .SetTypeMask(android::ResTable_map::TYPE_COLOR)
77 .Build())
78 .AddPublicSymbol("com.app.test:attr/attr",
Adam Lesinskicacb28f2016-10-19 12:18:14 -070079 ResourceId(0x7f010002),
Adam Lesinskice5e56e22016-10-21 17:56:45 -070080 test::AttributeBuilder().Build())
81 .Build())
82 .Build();
Adam Lesinskicacb28f2016-10-19 12:18:14 -070083 }
Adam Lesinski1ab598f2015-08-14 14:26:04 -070084
Adam Lesinskicacb28f2016-10-19 12:18:14 -070085 protected:
Adam Lesinskice5e56e22016-10-21 17:56:45 -070086 std::unique_ptr<IAaptContext> context_;
Adam Lesinski1ab598f2015-08-14 14:26:04 -070087};
88
Adam Lesinski1ab598f2015-08-14 14:26:04 -070089TEST_F(XmlReferenceLinkerTest, LinkBasicAttributes) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -070090 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -070091 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski1ab598f2015-08-14 14:26:04 -070092 <View xmlns:android="http://schemas.android.com/apk/res/android"
93 android:layout_width="match_parent"
94 android:background="@color/green"
95 android:text="hello"
96 class="hello" />)EOF");
97
Adam Lesinskicacb28f2016-10-19 12:18:14 -070098 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -070099 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700100
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700101 xml::Element* view_el = xml::FindRootElement(doc.get());
102 ASSERT_NE(view_el, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700103
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700104 xml::Attribute* xml_attr =
105 view_el->FindAttribute(xml::kSchemaAndroid, "layout_width");
106 ASSERT_NE(xml_attr, nullptr);
107 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
108 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
109 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700110 ResourceId(0x01010000));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700111 ASSERT_NE(xml_attr->compiled_value, nullptr);
112 ASSERT_NE(ValueCast<BinaryPrimitive>(xml_attr->compiled_value.get()),
113 nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700114
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700115 xml_attr = view_el->FindAttribute(xml::kSchemaAndroid, "background");
116 ASSERT_NE(xml_attr, nullptr);
117 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
118 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
119 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700120 ResourceId(0x01010001));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700121 ASSERT_NE(xml_attr->compiled_value, nullptr);
122 Reference* ref = ValueCast<Reference>(xml_attr->compiled_value.get());
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700123 ASSERT_NE(ref, nullptr);
124 AAPT_ASSERT_TRUE(ref->name);
125 EXPECT_EQ(ref->name.value(),
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700126 test::ParseNameOrDie("color/green")); // Make sure the name
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700127 // didn't change.
128 AAPT_ASSERT_TRUE(ref->id);
129 EXPECT_EQ(ref->id.value(), ResourceId(0x7f020000));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700130
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700131 xml_attr = view_el->FindAttribute(xml::kSchemaAndroid, "text");
132 ASSERT_NE(xml_attr, nullptr);
133 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700134 ASSERT_FALSE(
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700135 xml_attr->compiled_value); // Strings don't get compiled for memory sake.
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700136
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700137 xml_attr = view_el->FindAttribute("", "class");
138 ASSERT_NE(xml_attr, nullptr);
139 AAPT_ASSERT_FALSE(xml_attr->compiled_attribute);
140 ASSERT_EQ(xml_attr->compiled_value, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700141}
142
Adam Lesinski467f1712015-11-16 17:35:44 -0800143TEST_F(XmlReferenceLinkerTest, PrivateSymbolsAreNotLinked) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700144 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700145 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski467f1712015-11-16 17:35:44 -0800146 <View xmlns:android="http://schemas.android.com/apk/res/android"
147 android:colorAccent="@android:color/hidden" />)EOF");
148
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700149 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700150 ASSERT_FALSE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski467f1712015-11-16 17:35:44 -0800151}
152
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700153TEST_F(XmlReferenceLinkerTest,
154 PrivateSymbolsAreLinkedWhenReferenceHasStarPrefix) {
155 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700156 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski467f1712015-11-16 17:35:44 -0800157 <View xmlns:android="http://schemas.android.com/apk/res/android"
158 android:colorAccent="@*android:color/hidden" />)EOF");
159
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700160 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700161 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski467f1712015-11-16 17:35:44 -0800162}
163
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700164TEST_F(XmlReferenceLinkerTest, SdkLevelsAreRecorded) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700165 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700166 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700167 <View xmlns:android="http://schemas.android.com/apk/res/android"
168 android:colorAccent="#ffffff" />)EOF");
169
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700170 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700171 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
172 EXPECT_TRUE(linker.sdk_levels().count(21) == 1);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700173}
174
175TEST_F(XmlReferenceLinkerTest, LinkMangledAttributes) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700176 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700177 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700178 <View xmlns:support="http://schemas.android.com/apk/res/com.android.support"
179 support:colorAccent="#ff0000" />)EOF");
180
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700181 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700182 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700183
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700184 xml::Element* view_el = xml::FindRootElement(doc.get());
185 ASSERT_NE(view_el, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700186
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700187 xml::Attribute* xml_attr = view_el->FindAttribute(
188 xml::BuildPackageNamespace("com.android.support"), "colorAccent");
189 ASSERT_NE(xml_attr, nullptr);
190 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
191 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
192 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700193 ResourceId(0x7f010001));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700194 ASSERT_NE(ValueCast<BinaryPrimitive>(xml_attr->compiled_value.get()),
195 nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700196}
197
198TEST_F(XmlReferenceLinkerTest, LinkAutoResReference) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700199 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700200 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700201 <View xmlns:app="http://schemas.android.com/apk/res-auto"
202 app:colorAccent="@app:color/red" />)EOF");
203
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700204 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700205 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700206
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700207 xml::Element* view_el = xml::FindRootElement(doc.get());
208 ASSERT_NE(view_el, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700209
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700210 xml::Attribute* xml_attr =
211 view_el->FindAttribute(xml::kSchemaAuto, "colorAccent");
212 ASSERT_NE(xml_attr, nullptr);
213 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
214 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
215 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700216 ResourceId(0x7f010000));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700217 Reference* ref = ValueCast<Reference>(xml_attr->compiled_value.get());
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700218 ASSERT_NE(ref, nullptr);
219 AAPT_ASSERT_TRUE(ref->name);
220 AAPT_ASSERT_TRUE(ref->id);
221 EXPECT_EQ(ref->id.value(), ResourceId(0x7f020001));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700222}
223
224TEST_F(XmlReferenceLinkerTest, LinkViewWithShadowedPackageAlias) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700225 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700226 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700227 <View xmlns:app="http://schemas.android.com/apk/res/android"
228 app:attr="@app:id/id">
229 <View xmlns:app="http://schemas.android.com/apk/res/com.app.test"
230 app:attr="@app:id/id"/>
231 </View>)EOF");
232
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700233 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700234 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700235
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700236 xml::Element* view_el = xml::FindRootElement(doc.get());
237 ASSERT_NE(view_el, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700238
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700239 // All attributes and references in this element should be referring to
240 // "android" (0x01).
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700241 xml::Attribute* xml_attr =
242 view_el->FindAttribute(xml::kSchemaAndroid, "attr");
243 ASSERT_NE(xml_attr, nullptr);
244 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
245 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
246 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700247 ResourceId(0x01010002));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700248 Reference* ref = ValueCast<Reference>(xml_attr->compiled_value.get());
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700249 ASSERT_NE(ref, nullptr);
250 AAPT_ASSERT_TRUE(ref->id);
251 EXPECT_EQ(ref->id.value(), ResourceId(0x01030000));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700252
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700253 ASSERT_FALSE(view_el->GetChildElements().empty());
254 view_el = view_el->GetChildElements().front();
255 ASSERT_NE(view_el, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700256
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700257 // All attributes and references in this element should be referring to
258 // "com.app.test" (0x7f).
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700259 xml_attr = view_el->FindAttribute(xml::BuildPackageNamespace("com.app.test"),
260 "attr");
261 ASSERT_NE(xml_attr, nullptr);
262 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
263 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
264 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700265 ResourceId(0x7f010002));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700266 ref = ValueCast<Reference>(xml_attr->compiled_value.get());
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700267 ASSERT_NE(ref, nullptr);
268 AAPT_ASSERT_TRUE(ref->id);
269 EXPECT_EQ(ref->id.value(), ResourceId(0x7f030000));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700270}
271
272TEST_F(XmlReferenceLinkerTest, LinkViewWithLocalPackageAndAliasOfTheSameName) {
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700273 std::unique_ptr<xml::XmlResource> doc =
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700274 test::BuildXmlDomForPackageName(context_.get(), R"EOF(
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700275 <View xmlns:android="http://schemas.android.com/apk/res/com.app.test"
276 android:attr="@id/id"/>)EOF");
277
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700278 XmlReferenceLinker linker;
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700279 ASSERT_TRUE(linker.Consume(context_.get(), doc.get()));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700280
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700281 xml::Element* view_el = xml::FindRootElement(doc.get());
282 ASSERT_NE(view_el, nullptr);
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700283
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700284 // All attributes and references in this element should be referring to
285 // "com.app.test" (0x7f).
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700286 xml::Attribute* xml_attr = view_el->FindAttribute(
287 xml::BuildPackageNamespace("com.app.test"), "attr");
288 ASSERT_NE(xml_attr, nullptr);
289 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute);
290 AAPT_ASSERT_TRUE(xml_attr->compiled_attribute.value().id);
291 EXPECT_EQ(xml_attr->compiled_attribute.value().id.value(),
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700292 ResourceId(0x7f010002));
Adam Lesinskice5e56e22016-10-21 17:56:45 -0700293 Reference* ref = ValueCast<Reference>(xml_attr->compiled_value.get());
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700294 ASSERT_NE(ref, nullptr);
295 AAPT_ASSERT_TRUE(ref->id);
296 EXPECT_EQ(ref->id.value(), ResourceId(0x7f030000));
Adam Lesinski1ab598f2015-08-14 14:26:04 -0700297}
298
Adam Lesinskicacb28f2016-10-19 12:18:14 -0700299} // namespace aapt