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

Side by Side Diff: chrome/browser/chromeos/power/extension_event_observer_unittest.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/power/extension_event_observer.h" 5 #include "chrome/browser/chromeos/power/extension_event_observer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
9 #include <string> 10 #include <string>
10 11
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/ptr_util.h"
13 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
15 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 16 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
16 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 17 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
17 #include "chrome/browser/chromeos/settings/cros_settings.h" 18 #include "chrome/browser/chromeos/settings/cros_settings.h"
18 #include "chrome/browser/chromeos/settings/device_settings_service.h" 19 #include "chrome/browser/chromeos/settings/device_settings_service.h"
19 #include "chrome/common/extensions/api/gcm.h" 20 #include "chrome/common/extensions/api/gcm.h"
20 #include "chrome/test/base/testing_browser_process.h" 21 #include "chrome/test/base/testing_browser_process.h"
21 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
22 #include "chrome/test/base/testing_profile_manager.h" 23 #include "chrome/test/base/testing_profile_manager.h"
(...skipping 15 matching lines...) Expand all
38 namespace chromeos { 39 namespace chromeos {
39 40
40 class ExtensionEventObserverTest : public ::testing::Test { 41 class ExtensionEventObserverTest : public ::testing::Test {
41 public: 42 public:
42 ExtensionEventObserverTest() 43 ExtensionEventObserverTest()
43 : power_manager_client_(new FakePowerManagerClient()), 44 : power_manager_client_(new FakePowerManagerClient()),
44 test_screen_(aura::TestScreen::Create(gfx::Size())), 45 test_screen_(aura::TestScreen::Create(gfx::Size())),
45 fake_user_manager_(new FakeChromeUserManager()), 46 fake_user_manager_(new FakeChromeUserManager()),
46 scoped_user_manager_enabler_(fake_user_manager_) { 47 scoped_user_manager_enabler_(fake_user_manager_) {
47 DBusThreadManager::GetSetterForTesting()->SetPowerManagerClient( 48 DBusThreadManager::GetSetterForTesting()->SetPowerManagerClient(
48 make_scoped_ptr(power_manager_client_)); 49 base::WrapUnique(power_manager_client_));
49 50
50 profile_manager_.reset( 51 profile_manager_.reset(
51 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 52 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
52 53
53 extension_event_observer_.reset(new ExtensionEventObserver()); 54 extension_event_observer_.reset(new ExtensionEventObserver());
54 test_api_ = extension_event_observer_->CreateTestApi(); 55 test_api_ = extension_event_observer_->CreateTestApi();
55 } 56 }
56 57
57 ~ExtensionEventObserverTest() override { 58 ~ExtensionEventObserverTest() override {
58 extension_event_observer_.reset(); 59 extension_event_observer_.reset();
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 app, extensions::BackgroundInfo::GetBackgroundURL(app)); 122 app, extensions::BackgroundInfo::GetBackgroundURL(app));
122 base::RunLoop().RunUntilIdle(); 123 base::RunLoop().RunUntilIdle();
123 124
124 return extensions::ProcessManager::Get(profile) 125 return extensions::ProcessManager::Get(profile)
125 ->GetBackgroundHostForExtension(app->id()); 126 ->GetBackgroundHostForExtension(app->id());
126 } 127 }
127 128
128 // Owned by DBusThreadManager. 129 // Owned by DBusThreadManager.
129 FakePowerManagerClient* power_manager_client_; 130 FakePowerManagerClient* power_manager_client_;
130 131
131 scoped_ptr<ExtensionEventObserver> extension_event_observer_; 132 std::unique_ptr<ExtensionEventObserver> extension_event_observer_;
132 scoped_ptr<ExtensionEventObserver::TestApi> test_api_; 133 std::unique_ptr<ExtensionEventObserver::TestApi> test_api_;
133 134
134 // Owned by |profile_manager_|. 135 // Owned by |profile_manager_|.
135 TestingProfile* profile_; 136 TestingProfile* profile_;
136 scoped_ptr<TestingProfileManager> profile_manager_; 137 std::unique_ptr<TestingProfileManager> profile_manager_;
137 138
138 private: 139 private:
139 scoped_ptr<aura::TestScreen> test_screen_; 140 std::unique_ptr<aura::TestScreen> test_screen_;
140 content::TestBrowserThreadBundle browser_thread_bundle_; 141 content::TestBrowserThreadBundle browser_thread_bundle_;
141 142
142 // Needed to ensure we don't end up creating actual RenderViewHosts 143 // Needed to ensure we don't end up creating actual RenderViewHosts
143 // and RenderProcessHosts. 144 // and RenderProcessHosts.
144 content::RenderViewHostTestEnabler render_view_host_test_enabler_; 145 content::RenderViewHostTestEnabler render_view_host_test_enabler_;
145 146
146 // Chrome OS needs extra services to run in the following order. 147 // Chrome OS needs extra services to run in the following order.
147 ScopedTestDeviceSettingsService test_device_settings_service_; 148 ScopedTestDeviceSettingsService test_device_settings_service_;
148 ScopedTestCrosSettings test_cros_settings_; 149 ScopedTestCrosSettings test_cros_settings_;
149 150
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 EXPECT_FALSE(test_api_->MaybeRunSuspendReadinessCallback()); 327 EXPECT_FALSE(test_api_->MaybeRunSuspendReadinessCallback());
327 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); 328 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks());
328 329
329 // Test that the ExtensionEventObserver does not delay suspend attempts when 330 // Test that the ExtensionEventObserver does not delay suspend attempts when
330 // it is disabled. 331 // it is disabled.
331 power_manager_client_->SendDarkSuspendImminent(); 332 power_manager_client_->SendDarkSuspendImminent();
332 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks()); 333 EXPECT_EQ(0, power_manager_client_->GetNumPendingSuspendReadinessCallbacks());
333 } 334 }
334 335
335 } // namespace chromeos 336 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698