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

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

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/test/base/testing_pref_service_syncable.h" 25 #include "chrome/test/base/testing_pref_service_syncable.h"
26 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
27 #include "chrome/test/base/testing_profile_manager.h" 27 #include "chrome/test/base/testing_profile_manager.h"
28 #include "chromeos/dbus/fake_power_manager_client.h" 28 #include "chromeos/dbus/fake_power_manager_client.h"
29 #include "chromeos/dbus/power_manager/policy.pb.h" 29 #include "chromeos/dbus/power_manager/policy.pb.h"
30 #include "chromeos/dbus/power_policy_controller.h" 30 #include "chromeos/dbus/power_policy_controller.h"
31 #include "components/pref_registry/pref_registry_syncable.h" 31 #include "components/pref_registry/pref_registry_syncable.h"
32 #include "content/public/browser/notification_details.h" 32 #include "content/public/browser/notification_details.h"
33 #include "content/public/browser/notification_service.h" 33 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/notification_source.h" 34 #include "content/public/browser/notification_source.h"
35 #include "content/public/test/test_browser_thread_bundle.h"
35 #include "testing/gtest/include/gtest/gtest.h" 36 #include "testing/gtest/include/gtest/gtest.h"
36 37
37 namespace chromeos { 38 namespace chromeos {
38 39
39 class PowerPrefsTest : public testing::Test { 40 class PowerPrefsTest : public testing::Test {
40 protected: 41 protected:
41 // Screen lock state that determines which delays are used by 42 // Screen lock state that determines which delays are used by
42 // GetExpectedPowerPolicyForProfile(). 43 // GetExpectedPowerPolicyForProfile().
43 enum ScreenLockState { 44 enum ScreenLockState {
44 LOCKED, 45 LOCKED,
45 UNLOCKED, 46 UNLOCKED,
46 }; 47 };
47 48
48 PowerPrefsTest(); 49 PowerPrefsTest();
49 50
50 // testing::Test: 51 // testing::Test:
51 void SetUp() override; 52 void SetUp() override;
52 void TearDown() override; 53 void TearDown() override;
53 54
54 const Profile* GetProfile() const; 55 const Profile* GetProfile() const;
55 56
56 std::string GetExpectedPowerPolicyForProfile( 57 std::string GetExpectedPowerPolicyForProfile(
57 Profile* profile, 58 Profile* profile,
58 ScreenLockState screen_lock_state) const; 59 ScreenLockState screen_lock_state) const;
59 std::string GetCurrentPowerPolicy() const; 60 std::string GetCurrentPowerPolicy() const;
60 bool GetExpectedAllowScreenWakeLocksForProfile(Profile* profile) const; 61 bool GetExpectedAllowScreenWakeLocksForProfile(Profile* profile) const;
61 bool GetCurrentAllowScreenWakeLocks() const; 62 bool GetCurrentAllowScreenWakeLocks() const;
62 63
64 content::TestBrowserThreadBundle thread_bundle_;
63 TestingProfileManager profile_manager_; 65 TestingProfileManager profile_manager_;
64 PowerPolicyController* power_policy_controller_; // Not owned. 66 PowerPolicyController* power_policy_controller_; // Not owned.
65 scoped_ptr<FakePowerManagerClient> fake_power_manager_client_; 67 scoped_ptr<FakePowerManagerClient> fake_power_manager_client_;
66 68
67 scoped_ptr<PowerPrefs> power_prefs_; 69 scoped_ptr<PowerPrefs> power_prefs_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(PowerPrefsTest); 71 DISALLOW_COPY_AND_ASSIGN(PowerPrefsTest);
70 }; 72 };
71 73
72 PowerPrefsTest::PowerPrefsTest() 74 PowerPrefsTest::PowerPrefsTest()
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 content::Source<Profile>(user_profile), 295 content::Source<Profile>(user_profile),
294 content::NotificationService::NoDetails()); 296 content::NotificationService::NoDetails());
295 297
296 // The user profile's prefs should still be used. 298 // The user profile's prefs should still be used.
297 EXPECT_FALSE(GetProfile()); 299 EXPECT_FALSE(GetProfile());
298 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile, UNLOCKED), 300 EXPECT_EQ(GetExpectedPowerPolicyForProfile(user_profile, UNLOCKED),
299 GetCurrentPowerPolicy()); 301 GetCurrentPowerPolicy());
300 } 302 }
301 303
302 } // namespace chromeos 304 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698