AAPT2: Remove usage of u16string
For legacy reasons, we kept around the use of UTF-16 internally
in AAPT2. We don't need this and this CL removes all instances of
std::u16string and StringPiece16. The only places still needed
are when interacting with the ResTable APIs that only operate in
UTF16.
Change-Id: I492475b84bb9014fa13bf992cff447ee7a5fe588
diff --git a/tools/aapt2/xml/XmlUtil_test.cpp b/tools/aapt2/xml/XmlUtil_test.cpp
index 319e770..cbeb8bc 100644
--- a/tools/aapt2/xml/XmlUtil_test.cpp
+++ b/tools/aapt2/xml/XmlUtil_test.cpp
@@ -14,40 +14,37 @@
* limitations under the License.
*/
-#include "test/Common.h"
+#include "test/Test.h"
#include "xml/XmlUtil.h"
-#include <gtest/gtest.h>
-
namespace aapt {
TEST(XmlUtilTest, ExtractPackageFromNamespace) {
- AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace(u"com.android"));
- AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace(u"http://schemas.android.com/apk"));
- AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace(u"http://schemas.android.com/apk/res"));
- AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace(u"http://schemas.android.com/apk/res/"));
- AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace(
- u"http://schemas.android.com/apk/prv/res/"));
+ AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace("com.android"));
+ AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace("http://schemas.android.com/apk"));
+ AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace("http://schemas.android.com/apk/res"));
+ AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace("http://schemas.android.com/apk/res/"));
+ AAPT_ASSERT_FALSE(xml::extractPackageFromNamespace("http://schemas.android.com/apk/prv/res/"));
Maybe<xml::ExtractedPackage> p =
- xml::extractPackageFromNamespace(u"http://schemas.android.com/apk/res/a");
+ xml::extractPackageFromNamespace("http://schemas.android.com/apk/res/a");
AAPT_ASSERT_TRUE(p);
- EXPECT_EQ(std::u16string(u"a"), p.value().package);
+ EXPECT_EQ(std::string("a"), p.value().package);
EXPECT_FALSE(p.value().privateNamespace);
- p = xml::extractPackageFromNamespace(u"http://schemas.android.com/apk/prv/res/android");
+ p = xml::extractPackageFromNamespace("http://schemas.android.com/apk/prv/res/android");
AAPT_ASSERT_TRUE(p);
- EXPECT_EQ(std::u16string(u"android"), p.value().package);
+ EXPECT_EQ(std::string("android"), p.value().package);
EXPECT_TRUE(p.value().privateNamespace);
- p = xml::extractPackageFromNamespace(u"http://schemas.android.com/apk/prv/res/com.test");
+ p = xml::extractPackageFromNamespace("http://schemas.android.com/apk/prv/res/com.test");
AAPT_ASSERT_TRUE(p);
- EXPECT_EQ(std::u16string(u"com.test"), p.value().package);
+ EXPECT_EQ(std::string("com.test"), p.value().package);
EXPECT_TRUE(p.value().privateNamespace);
- p = xml::extractPackageFromNamespace(u"http://schemas.android.com/apk/res-auto");
+ p = xml::extractPackageFromNamespace("http://schemas.android.com/apk/res-auto");
AAPT_ASSERT_TRUE(p);
- EXPECT_EQ(std::u16string(), p.value().package);
+ EXPECT_EQ(std::string(), p.value().package);
EXPECT_TRUE(p.value().privateNamespace);
}