| 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");
|
| }
|
|
|