Index: extensions/common/features/simple_feature_unittest.cc |
diff --git a/extensions/common/features/simple_feature_unittest.cc b/extensions/common/features/simple_feature_unittest.cc |
index afe8d7cef5d8baa85132f61c6731654515332564..ff69597ed459f7c32180ddf6b395765a10412de4 100644 |
--- a/extensions/common/features/simple_feature_unittest.cc |
+++ b/extensions/common/features/simple_feature_unittest.cc |
@@ -11,6 +11,7 @@ |
#include "base/command_line.h" |
#include "base/macros.h" |
#include "base/stl_util.h" |
+#include "base/test/command_line_test_util.h" |
#include "base/values.h" |
#include "extensions/common/manifest.h" |
#include "extensions/common/value_builder.h" |
@@ -29,21 +30,6 @@ struct IsAvailableTestData { |
Feature::AvailabilityResult expected_result; |
}; |
-class ScopedCommandLineSwitch { |
- public: |
- explicit ScopedCommandLineSwitch(const std::string& arg) |
- : original_command_line_(*base::CommandLine::ForCurrentProcess()) { |
- base::CommandLine::ForCurrentProcess()->AppendSwitch(arg); |
- } |
- |
- ~ScopedCommandLineSwitch() { |
- *base::CommandLine::ForCurrentProcess() = original_command_line_; |
- } |
- |
- private: |
- base::CommandLine original_command_line_; |
-}; |
- |
} // namespace |
class SimpleFeatureTest : public testing::Test { |
@@ -704,27 +690,34 @@ TEST_F(SimpleFeatureTest, CommandLineSwitch) { |
feature.IsAvailableToEnvironment().result()); |
} |
{ |
- ScopedCommandLineSwitch scoped_switch("laser-beams"); |
+ base::test::ScopedCommandLine scoped_command_line; |
+ scoped_command_line.GetProcessCommandLine()->AppendSwitch("laser-beams"); |
EXPECT_EQ(Feature::MISSING_COMMAND_LINE_SWITCH, |
feature.IsAvailableToEnvironment().result()); |
} |
{ |
- ScopedCommandLineSwitch scoped_switch("enable-laser-beams"); |
+ base::test::ScopedCommandLine scoped_command_line; |
+ scoped_command_line.GetProcessCommandLine()->AppendSwitch( |
+ "enable-laser-beams"); |
EXPECT_EQ(Feature::IS_AVAILABLE, |
feature.IsAvailableToEnvironment().result()); |
} |
{ |
- ScopedCommandLineSwitch scoped_switch("disable-laser-beams"); |
+ base::test::ScopedCommandLine scoped_command_line; |
+ scoped_command_line.GetProcessCommandLine()->AppendSwitch( |
+ "disable-laser-beams"); |
EXPECT_EQ(Feature::MISSING_COMMAND_LINE_SWITCH, |
feature.IsAvailableToEnvironment().result()); |
} |
{ |
- ScopedCommandLineSwitch scoped_switch("laser-beams=1"); |
+ base::test::ScopedCommandLine scoped_command_line; |
+ scoped_command_line.GetProcessCommandLine()->AppendSwitch("laser-beams=1"); |
EXPECT_EQ(Feature::IS_AVAILABLE, |
feature.IsAvailableToEnvironment().result()); |
} |
{ |
- ScopedCommandLineSwitch scoped_switch("laser-beams=0"); |
+ base::test::ScopedCommandLine scoped_command_line; |
+ scoped_command_line.GetProcessCommandLine()->AppendSwitch("laser-beams=0"); |
EXPECT_EQ(Feature::MISSING_COMMAND_LINE_SWITCH, |
feature.IsAvailableToEnvironment().result()); |
} |