Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1428)

Unified Diff: android_webview/browser/command_line_helper_unittest.cc

Issue 2520053002: [Merge M-55] Disable Web Payments in WebView (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/browser/command_line_helper.cc ('k') | android_webview/lib/main/aw_main_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/browser/command_line_helper_unittest.cc
diff --git a/android_webview/browser/command_line_helper_unittest.cc b/android_webview/browser/command_line_helper_unittest.cc
index 4df2e3983ca25e7ed226df9734a01b40c6644561..07951c46e07c04e7cd719a0c910503262842b27e 100644
--- a/android_webview/browser/command_line_helper_unittest.cc
+++ b/android_webview/browser/command_line_helper_unittest.cc
@@ -20,11 +20,25 @@ class CommandLineHelperTest : public Test {
public:
CommandLineHelperTest() {}
- void AddFeatureAndVerify(CommandLine& command_line,
- const std::string& enabled_expected,
- const std::string& disabled_expected) {
+ void EnableFeatureAndVerify(CommandLine& command_line,
+ const std::string& enabled_expected,
+ const std::string& disabled_expected) {
CommandLineHelper::AddEnabledFeature(command_line,
kSomeSpecialFeature.name);
+ Verify(command_line, enabled_expected, disabled_expected);
+ }
+
+ void DisableFeatureAndVerify(CommandLine& command_line,
+ const std::string& enabled_expected,
+ const std::string& disabled_expected) {
+ CommandLineHelper::AddDisabledFeature(command_line,
+ kSomeSpecialFeature.name);
+ Verify(command_line, enabled_expected, disabled_expected);
+ }
+
+ void Verify(const CommandLine& command_line,
+ const std::string& enabled_expected,
+ const std::string& disabled_expected) {
EXPECT_EQ(enabled_expected,
command_line.GetSwitchValueASCII(switches::kEnableFeatures));
EXPECT_EQ(disabled_expected,
@@ -32,45 +46,88 @@ class CommandLineHelperTest : public Test {
}
};
-TEST_F(CommandLineHelperTest, AddWithEmptyCommandLine) {
+TEST_F(CommandLineHelperTest, EnableForEmptyCommandLine) {
CommandLine command_line(CommandLine::NO_PROGRAM);
- AddFeatureAndVerify(command_line, "SomeSpecialFeature", "");
+ EnableFeatureAndVerify(command_line, "SomeSpecialFeature", "");
}
-TEST_F(CommandLineHelperTest, AddWithNoEnabledFeatures) {
+TEST_F(CommandLineHelperTest, EnableForNoEnabledFeatures) {
const CommandLine::CharType* argv[] = {FILE_PATH_LITERAL("program")};
CommandLine command_line(arraysize(argv), argv);
- AddFeatureAndVerify(command_line, "SomeSpecialFeature", "");
+ EnableFeatureAndVerify(command_line, "SomeSpecialFeature", "");
}
-TEST_F(CommandLineHelperTest, AddWithEnabledTestFeature) {
+TEST_F(CommandLineHelperTest, EnableForEnabledTestFeature) {
const CommandLine::CharType* argv[] = {
FILE_PATH_LITERAL("program"),
FILE_PATH_LITERAL("--enable-features=TestFeature")};
CommandLine command_line(arraysize(argv), argv);
- AddFeatureAndVerify(command_line, "TestFeature,SomeSpecialFeature", "");
+ EnableFeatureAndVerify(command_line, "TestFeature,SomeSpecialFeature", "");
}
-TEST_F(CommandLineHelperTest, AddWithEnabledSomeSpecialFeature) {
+TEST_F(CommandLineHelperTest, EnableForEnabledSomeSpecialFeature) {
const CommandLine::CharType* argv[] = {
FILE_PATH_LITERAL("program"),
FILE_PATH_LITERAL("--enable-features=SomeSpecialFeature,TestFeature")};
CommandLine command_line(arraysize(argv), argv);
- AddFeatureAndVerify(command_line, "SomeSpecialFeature,TestFeature", "");
+ EnableFeatureAndVerify(command_line, "SomeSpecialFeature,TestFeature", "");
}
-TEST_F(CommandLineHelperTest, AddWithDisabledSomeSpecialFeature) {
+TEST_F(CommandLineHelperTest, EnableForDisabledSomeSpecialFeature) {
const CommandLine::CharType* argv[] = {
FILE_PATH_LITERAL("program"),
FILE_PATH_LITERAL("--disable-features=SomeSpecialFeature")};
CommandLine command_line(arraysize(argv), argv);
- AddFeatureAndVerify(command_line, "", "SomeSpecialFeature");
+ EnableFeatureAndVerify(command_line, "", "SomeSpecialFeature");
+}
+
+TEST_F(CommandLineHelperTest, EnableForDisabledTestFeature) {
+ const CommandLine::CharType* argv[] = {
+ FILE_PATH_LITERAL("program"),
+ FILE_PATH_LITERAL("--disable-features=TestFeature")};
+ CommandLine command_line(arraysize(argv), argv);
+ EnableFeatureAndVerify(command_line, "SomeSpecialFeature", "TestFeature");
+}
+
+TEST_F(CommandLineHelperTest, DisableForEmptyCommandLine) {
+ CommandLine command_line(CommandLine::NO_PROGRAM);
+ DisableFeatureAndVerify(command_line, "", "SomeSpecialFeature");
+}
+
+TEST_F(CommandLineHelperTest, DisableForNoDisabledFeatures) {
+ const CommandLine::CharType* argv[] = {FILE_PATH_LITERAL("program")};
+ CommandLine command_line(arraysize(argv), argv);
+ DisableFeatureAndVerify(command_line, "", "SomeSpecialFeature");
}
-TEST_F(CommandLineHelperTest, AddWithDisabledTestFeature) {
+TEST_F(CommandLineHelperTest, DisableForDisabledTestFeature) {
const CommandLine::CharType* argv[] = {
FILE_PATH_LITERAL("program"),
FILE_PATH_LITERAL("--disable-features=TestFeature")};
CommandLine command_line(arraysize(argv), argv);
- AddFeatureAndVerify(command_line, "SomeSpecialFeature", "TestFeature");
+ DisableFeatureAndVerify(command_line, "", "TestFeature,SomeSpecialFeature");
+}
+
+TEST_F(CommandLineHelperTest, DisableForDisabledSomeSpecialFeature) {
+ const CommandLine::CharType* argv[] = {
+ FILE_PATH_LITERAL("program"),
+ FILE_PATH_LITERAL("--disable-features=SomeSpecialFeature,TestFeature")};
+ CommandLine command_line(arraysize(argv), argv);
+ DisableFeatureAndVerify(command_line, "", "SomeSpecialFeature,TestFeature");
+}
+
+TEST_F(CommandLineHelperTest, DisableForEnabledSomeSpecialFeature) {
+ const CommandLine::CharType* argv[] = {
+ FILE_PATH_LITERAL("program"),
+ FILE_PATH_LITERAL("--enable-features=SomeSpecialFeature")};
+ CommandLine command_line(arraysize(argv), argv);
+ DisableFeatureAndVerify(command_line, "SomeSpecialFeature", "");
+}
+
+TEST_F(CommandLineHelperTest, DisableForEnabledTestFeature) {
+ const CommandLine::CharType* argv[] = {
+ FILE_PATH_LITERAL("program"),
+ FILE_PATH_LITERAL("--enable-features=TestFeature")};
+ CommandLine command_line(arraysize(argv), argv);
+ DisableFeatureAndVerify(command_line, "TestFeature", "SomeSpecialFeature");
}
« no previous file with comments | « android_webview/browser/command_line_helper.cc ('k') | android_webview/lib/main/aw_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698