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

Side by Side Diff: chrome/browser/chromeos/power/power_prefs_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/power_prefs.h" 5 #include "chrome/browser/chromeos/power/power_prefs.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 std::string GetExpectedPowerPolicyForProfile( 59 std::string GetExpectedPowerPolicyForProfile(
60 Profile* profile, 60 Profile* profile,
61 ScreenLockState screen_lock_state) const; 61 ScreenLockState screen_lock_state) const;
62 std::string GetCurrentPowerPolicy() const; 62 std::string GetCurrentPowerPolicy() const;
63 bool GetExpectedAllowScreenWakeLocksForProfile(Profile* profile) const; 63 bool GetExpectedAllowScreenWakeLocksForProfile(Profile* profile) const;
64 bool GetCurrentAllowScreenWakeLocks() const; 64 bool GetCurrentAllowScreenWakeLocks() const;
65 65
66 content::TestBrowserThreadBundle thread_bundle_; 66 content::TestBrowserThreadBundle thread_bundle_;
67 TestingProfileManager profile_manager_; 67 TestingProfileManager profile_manager_;
68 PowerPolicyController* power_policy_controller_; // Not owned. 68 PowerPolicyController* power_policy_controller_; // Not owned.
69 scoped_ptr<FakePowerManagerClient> fake_power_manager_client_; 69 std::unique_ptr<FakePowerManagerClient> fake_power_manager_client_;
70 70
71 scoped_ptr<PowerPrefs> power_prefs_; 71 std::unique_ptr<PowerPrefs> power_prefs_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(PowerPrefsTest); 73 DISALLOW_COPY_AND_ASSIGN(PowerPrefsTest);
74 }; 74 };
75 75
76 PowerPrefsTest::PowerPrefsTest() 76 PowerPrefsTest::PowerPrefsTest()
77 : profile_manager_(TestingBrowserProcess::GetGlobal()), 77 : profile_manager_(TestingBrowserProcess::GetGlobal()),
78 power_policy_controller_(NULL), 78 power_policy_controller_(NULL),
79 fake_power_manager_client_(new FakePowerManagerClient) { 79 fake_power_manager_client_(new FakePowerManagerClient) {
80 } 80 }
81 81
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return power_policy_controller_->honor_screen_wake_locks_; 167 return power_policy_controller_->honor_screen_wake_locks_;
168 } 168 }
169 169
170 bool PowerPrefsTest::GetExpectedAllowScreenWakeLocksForProfile( 170 bool PowerPrefsTest::GetExpectedAllowScreenWakeLocksForProfile(
171 Profile* profile) const { 171 Profile* profile) const {
172 return profile->GetPrefs()->GetBoolean(prefs::kPowerAllowScreenWakeLocks); 172 return profile->GetPrefs()->GetBoolean(prefs::kPowerAllowScreenWakeLocks);
173 } 173 }
174 174
175 TEST_F(PowerPrefsTest, LoginScreen) { 175 TEST_F(PowerPrefsTest, LoginScreen) {
176 // Set up login profile. 176 // Set up login profile.
177 scoped_ptr<syncable_prefs::TestingPrefServiceSyncable> login_profile_prefs( 177 std::unique_ptr<syncable_prefs::TestingPrefServiceSyncable>
178 new syncable_prefs::TestingPrefServiceSyncable); 178 login_profile_prefs(new syncable_prefs::TestingPrefServiceSyncable);
179 chrome::RegisterLoginProfilePrefs(login_profile_prefs->registry()); 179 chrome::RegisterLoginProfilePrefs(login_profile_prefs->registry());
180 TestingProfile::Builder builder; 180 TestingProfile::Builder builder;
181 builder.SetPath( 181 builder.SetPath(
182 profile_manager_.profiles_dir().AppendASCII(chrome::kInitialProfile)); 182 profile_manager_.profiles_dir().AppendASCII(chrome::kInitialProfile));
183 builder.SetPrefService(std::move(login_profile_prefs)); 183 builder.SetPrefService(std::move(login_profile_prefs));
184 TestingProfile* login_profile = builder.BuildIncognito( 184 TestingProfile* login_profile = builder.BuildIncognito(
185 profile_manager_.CreateTestingProfile(chrome::kInitialProfile)); 185 profile_manager_.CreateTestingProfile(chrome::kInitialProfile));
186 186
187 // Inform power_prefs_ that the login screen is being shown. 187 // Inform power_prefs_ that the login screen is being shown.
188 power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, 188 power_prefs_->Observe(chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 content::Source<Profile>(user_profile), 299 content::Source<Profile>(user_profile),
300 content::NotificationService::NoDetails()); 300 content::NotificationService::NoDetails());
301 301
302 // The user profile's prefs should still be used. 302 // The user profile's prefs should still be used.
303 EXPECT_FALSE(GetProfile()); 303 EXPECT_FALSE(GetProfile());
304 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile, UNLOCKED), 304 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile, UNLOCKED),
305 GetCurrentPowerPolicy()); 305 GetCurrentPowerPolicy());
306 } 306 }
307 307
308 } // namespace chromeos 308 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/power/power_prefs.h ('k') | chrome/browser/chromeos/power/renderer_freezer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698