summaryrefslogtreecommitdiff
path: root/tools/aapt2/xml/XmlActionExecutor_test.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2016-10-21 17:56:45 -0700
committerAdam Lesinski <adamlesinski@google.com>2016-10-26 19:30:23 -0700
commitce5e56e243d262a9b65459c3bd0bb9eaadd40628 (patch)
treecf0ecea98883d090d8d2856fc6d32046c7e3d9e8 /tools/aapt2/xml/XmlActionExecutor_test.cpp
parent0f7cc4dc2c49a30c072cbc7aa6c0c5d5c31496d4 (diff)
AAPT2: Rename to match new style
Use Google3 naming style to match new projects' and open source google projects' style. Preferred to do this in a massive CL so as to avoid style inconsistencies that plague legacy code bases. This is a relatively NEW code base, may as well keep it up to date. Test: name/style refactor - existing tests pass Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
Diffstat (limited to 'tools/aapt2/xml/XmlActionExecutor_test.cpp')
-rw-r--r--tools/aapt2/xml/XmlActionExecutor_test.cpp72
1 files changed, 38 insertions, 34 deletions
diff --git a/tools/aapt2/xml/XmlActionExecutor_test.cpp b/tools/aapt2/xml/XmlActionExecutor_test.cpp
index 106e85601f6e..7110c90fa3a9 100644
--- a/tools/aapt2/xml/XmlActionExecutor_test.cpp
+++ b/tools/aapt2/xml/XmlActionExecutor_test.cpp
@@ -14,49 +14,53 @@
* limitations under the License.
*/
-#include "test/Test.h"
#include "xml/XmlActionExecutor.h"
+#include "test/Test.h"
+
namespace aapt {
namespace xml {
TEST(XmlActionExecutorTest, BuildsAccessibleNestedPattern) {
- XmlActionExecutor executor;
- XmlNodeAction& manifestAction = executor["manifest"];
- XmlNodeAction& applicationAction = manifestAction["application"];
-
- Element* manifestEl = nullptr;
- manifestAction.action([&](Element* manifest) -> bool {
- manifestEl = manifest;
- return true;
- });
-
- Element* applicationEl = nullptr;
- applicationAction.action([&](Element* application) -> bool {
- applicationEl = application;
- return true;
- });
-
- std::unique_ptr<XmlResource> doc = test::buildXmlDom("<manifest><application /></manifest>");
-
- StdErrDiagnostics diag;
- ASSERT_TRUE(executor.execute(XmlActionExecutorPolicy::None, &diag, doc.get()));
- ASSERT_NE(nullptr, manifestEl);
- EXPECT_EQ(std::string("manifest"), manifestEl->name);
-
- ASSERT_NE(nullptr, applicationEl);
- EXPECT_EQ(std::string("application"), applicationEl->name);
+ XmlActionExecutor executor;
+ XmlNodeAction& manifest_action = executor["manifest"];
+ XmlNodeAction& application_action = manifest_action["application"];
+
+ Element* manifest_el = nullptr;
+ manifest_action.Action([&](Element* manifest) -> bool {
+ manifest_el = manifest;
+ return true;
+ });
+
+ Element* application_el = nullptr;
+ application_action.Action([&](Element* application) -> bool {
+ application_el = application;
+ return true;
+ });
+
+ std::unique_ptr<XmlResource> doc =
+ test::BuildXmlDom("<manifest><application /></manifest>");
+
+ StdErrDiagnostics diag;
+ ASSERT_TRUE(
+ executor.Execute(XmlActionExecutorPolicy::kNone, &diag, doc.get()));
+ ASSERT_NE(nullptr, manifest_el);
+ EXPECT_EQ(std::string("manifest"), manifest_el->name);
+
+ ASSERT_NE(nullptr, application_el);
+ EXPECT_EQ(std::string("application"), application_el->name);
}
TEST(XmlActionExecutorTest, FailsWhenUndefinedHierarchyExists) {
- XmlActionExecutor executor;
- executor["manifest"]["application"];
+ XmlActionExecutor executor;
+ executor["manifest"]["application"];
- std::unique_ptr<XmlResource> doc = test::buildXmlDom(
- "<manifest><application /><activity /></manifest>");
- StdErrDiagnostics diag;
- ASSERT_FALSE(executor.execute(XmlActionExecutorPolicy::Whitelist, &diag, doc.get()));
+ std::unique_ptr<XmlResource> doc =
+ test::BuildXmlDom("<manifest><application /><activity /></manifest>");
+ StdErrDiagnostics diag;
+ ASSERT_FALSE(
+ executor.Execute(XmlActionExecutorPolicy::kWhitelist, &diag, doc.get()));
}
-} // namespace xml
-} // namespace aapt
+} // namespace xml
+} // namespace aapt