OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/chromeos/login/login_manager_test.h" | 9 #include "chrome/browser/chromeos/login/login_manager_test.h" |
10 #include "chrome/browser/chromeos/login/startup_utils.h" | 10 #include "chrome/browser/chromeos/login/startup_utils.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // which the Settings page doesn't expect. | 44 // which the Settings page doesn't expect. |
45 class StubAccountSettingsProvider : public StubCrosSettingsProvider { | 45 class StubAccountSettingsProvider : public StubCrosSettingsProvider { |
46 public: | 46 public: |
47 StubAccountSettingsProvider() { | 47 StubAccountSettingsProvider() { |
48 } | 48 } |
49 | 49 |
50 virtual ~StubAccountSettingsProvider() { | 50 virtual ~StubAccountSettingsProvider() { |
51 } | 51 } |
52 | 52 |
53 // StubCrosSettingsProvider implementation. | 53 // StubCrosSettingsProvider implementation. |
54 virtual bool HandlesSetting(const std::string& path) const OVERRIDE { | 54 virtual bool HandlesSetting(const std::string& path) const override { |
55 const char** end = kKnownSettings + arraysize(kKnownSettings); | 55 const char** end = kKnownSettings + arraysize(kKnownSettings); |
56 return std::find(kKnownSettings, end, path) != end; | 56 return std::find(kKnownSettings, end, path) != end; |
57 } | 57 } |
58 }; | 58 }; |
59 | 59 |
60 struct PrefTest { | 60 struct PrefTest { |
61 const char* pref_name; | 61 const char* pref_name; |
62 bool owner_only; | 62 bool owner_only; |
63 bool indicator; | 63 bool indicator; |
64 }; | 64 }; |
(...skipping 18 matching lines...) Expand all Loading... |
83 public: | 83 public: |
84 SharedOptionsTest() | 84 SharedOptionsTest() |
85 : LoginManagerTest(false), | 85 : LoginManagerTest(false), |
86 device_settings_provider_(NULL) { | 86 device_settings_provider_(NULL) { |
87 stub_settings_provider_.Set(kDeviceOwner, base::StringValue(kTestOwner)); | 87 stub_settings_provider_.Set(kDeviceOwner, base::StringValue(kTestOwner)); |
88 } | 88 } |
89 | 89 |
90 virtual ~SharedOptionsTest() { | 90 virtual ~SharedOptionsTest() { |
91 } | 91 } |
92 | 92 |
93 virtual void SetUpOnMainThread() OVERRIDE { | 93 virtual void SetUpOnMainThread() override { |
94 LoginManagerTest::SetUpOnMainThread(); | 94 LoginManagerTest::SetUpOnMainThread(); |
95 | 95 |
96 CrosSettings* settings = CrosSettings::Get(); | 96 CrosSettings* settings = CrosSettings::Get(); |
97 | 97 |
98 // Add the stub settings provider, moving the device settings provider | 98 // Add the stub settings provider, moving the device settings provider |
99 // behind it so our stub takes precedence. | 99 // behind it so our stub takes precedence. |
100 device_settings_provider_ = settings->GetProvider(kDeviceOwner); | 100 device_settings_provider_ = settings->GetProvider(kDeviceOwner); |
101 settings->RemoveSettingsProvider(device_settings_provider_); | 101 settings->RemoveSettingsProvider(device_settings_provider_); |
102 settings->AddSettingsProvider(&stub_settings_provider_); | 102 settings->AddSettingsProvider(&stub_settings_provider_); |
103 settings->AddSettingsProvider(device_settings_provider_); | 103 settings->AddSettingsProvider(device_settings_provider_); |
104 } | 104 } |
105 | 105 |
106 virtual void TearDownOnMainThread() OVERRIDE { | 106 virtual void TearDownOnMainThread() override { |
107 CrosSettings* settings = CrosSettings::Get(); | 107 CrosSettings* settings = CrosSettings::Get(); |
108 settings->RemoveSettingsProvider(&stub_settings_provider_); | 108 settings->RemoveSettingsProvider(&stub_settings_provider_); |
109 LoginManagerTest::TearDownOnMainThread(); | 109 LoginManagerTest::TearDownOnMainThread(); |
110 } | 110 } |
111 | 111 |
112 protected: | 112 protected: |
113 void CheckOptionsUI(const user_manager::User* user, | 113 void CheckOptionsUI(const user_manager::User* user, |
114 bool is_owner, | 114 bool is_owner, |
115 bool is_primary) { | 115 bool is_primary) { |
116 Browser* browser = CreateBrowserForUser(user); | 116 Browser* browser = CreateBrowserForUser(user); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 content::WaitForLoadStop(contents); | 422 content::WaitForLoadStop(contents); |
423 { | 423 { |
424 SCOPED_TRACE("Screen lock false for both users"); | 424 SCOPED_TRACE("Screen lock false for both users"); |
425 expected_value = false; | 425 expected_value = false; |
426 CheckBooleanPreference(contents, prefs::kEnableAutoScreenLock, disabled, | 426 CheckBooleanPreference(contents, prefs::kEnableAutoScreenLock, disabled, |
427 empty_controlled, expected_value); | 427 empty_controlled, expected_value); |
428 } | 428 } |
429 } | 429 } |
430 | 430 |
431 } // namespace chromeos | 431 } // namespace chromeos |
OLD | NEW |