| Index: chrome/browser/extensions/activity_log/counting_policy_unittest.cc
|
| diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
|
| index 8b08a4abf519791ef0503dcaef8133ffc4b31d36..b0aa2dee085dd039d470bf3b6311a5a455cae49e 100644
|
| --- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
|
| +++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
|
| @@ -19,6 +19,7 @@
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/synchronization/waitable_event.h"
|
| +#include "base/test/command_line_test_util.h"
|
| #include "base/test/simple_test_clock.h"
|
| #include "base/test/test_timeouts.h"
|
| #include "base/thread_task_runner_handle.h"
|
| @@ -48,16 +49,14 @@ namespace extensions {
|
| class CountingPolicyTest : public testing::Test {
|
| public:
|
| CountingPolicyTest()
|
| - : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
|
| - saved_cmdline_(base::CommandLine::NO_PROGRAM) {
|
| + : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
|
| #if defined OS_CHROMEOS
|
| test_user_manager_.reset(new chromeos::ScopedTestUserManager());
|
| #endif
|
| - base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
|
| - saved_cmdline_ = *base::CommandLine::ForCurrentProcess();
|
| profile_.reset(new TestingProfile());
|
| - base::CommandLine::ForCurrentProcess()->AppendSwitch(
|
| - switches::kEnableExtensionActivityLogging);
|
| + scoped_command_line_.GetProcessCommandLine()->
|
| + AppendSwitch(switches::kEnableExtensionActivityLogging);
|
| + base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
|
| extension_service_ = static_cast<TestExtensionSystem*>(
|
| ExtensionSystem::Get(profile_.get()))->CreateExtensionService
|
| (&command_line, base::FilePath(), false);
|
| @@ -70,8 +69,6 @@ class CountingPolicyTest : public testing::Test {
|
| base::RunLoop().RunUntilIdle();
|
| profile_.reset(NULL);
|
| base::RunLoop().RunUntilIdle();
|
| - // Restore the original command line and undo the affects of SetUp().
|
| - *base::CommandLine::ForCurrentProcess() = saved_cmdline_;
|
| }
|
|
|
| // Wait for the task queue for the specified thread to empty.
|
| @@ -526,11 +523,7 @@ class CountingPolicyTest : public testing::Test {
|
| ExtensionService* extension_service_;
|
| std::unique_ptr<TestingProfile> profile_;
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| - // Used to preserve a copy of the original command line.
|
| - // The test framework will do this itself as well. However, by then,
|
| - // it is too late to call ActivityLog::RecomputeLoggingIsEnabled() in
|
| - // TearDown().
|
| - base::CommandLine saved_cmdline_;
|
| + base::test::ScopedCommandLine scoped_command_line_;
|
|
|
| #if defined OS_CHROMEOS
|
| chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
|
|
|