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

Side by Side Diff: chrome/browser/chromeos/login/screens/device_disabled_screen_unittest.cc

Issue 690643002: Add RESTORE_MODE_DISABLED to RestoreMode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment. Created 6 years, 1 month 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 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 "chrome/browser/chromeos/login/screens/device_disabled_screen.h" 5 #include "chrome/browser/chromeos/login/screens/device_disabled_screen.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 void DeviceDisabledScreenTest::ShowErrorScreen() { 97 void DeviceDisabledScreenTest::ShowErrorScreen() {
98 } 98 }
99 99
100 void DeviceDisabledScreenTest::HideErrorScreen(BaseScreen* parent_screen) { 100 void DeviceDisabledScreenTest::HideErrorScreen(BaseScreen* parent_screen) {
101 } 101 }
102 102
103 void DeviceDisabledScreenTest::SetDeviceDisabled(bool disabled) { 103 void DeviceDisabledScreenTest::SetDeviceDisabled(bool disabled) {
104 DictionaryPrefUpdate dict(&local_state_, prefs::kServerBackedDeviceState); 104 DictionaryPrefUpdate dict(&local_state_, prefs::kServerBackedDeviceState);
105 dict->SetBoolean(policy::kDeviceStateDisabled, disabled); 105 if (disabled) {
106 if (disabled) 106 dict->SetString(policy::kDeviceStateRestoreMode,
107 dict->SetString(policy::kDeviceStateDisabledMessage, kDisabledMessage); 107 policy::kDeviceStateRestoreModeDisabled);
108 } else {
109 dict->Remove(policy::kDeviceStateRestoreMode, nullptr);
110 }
111 dict->SetString(policy::kDeviceStateDisabledMessage, kDisabledMessage);
108 } 112 }
109 113
110 void DeviceDisabledScreenTest::SetDeviceMode(policy::DeviceMode device_mode) { 114 void DeviceDisabledScreenTest::SetDeviceMode(policy::DeviceMode device_mode) {
111 reinterpret_cast<policy::StubEnterpriseInstallAttributes*>( 115 reinterpret_cast<policy::StubEnterpriseInstallAttributes*>(
112 TestingBrowserProcess::GetGlobal()->platform_part()-> 116 TestingBrowserProcess::GetGlobal()->platform_part()->
113 browser_policy_connector_chromeos()->GetInstallAttributes())-> 117 browser_policy_connector_chromeos()->GetInstallAttributes())->
114 SetMode(device_mode); 118 SetMode(device_mode);
115 } 119 }
116 120
117 void DeviceDisabledScreenTest::ExpectScreenToNotShow() { 121 void DeviceDisabledScreenTest::ExpectScreenToNotShow() {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Verifies that the device disabled screen is shown when the device is marked 177 // Verifies that the device disabled screen is shown when the device is marked
174 // as disabled, device disabling is not turned off by flag and the device is not 178 // as disabled, device disabling is not turned off by flag and the device is not
175 // owned yet. 179 // owned yet.
176 TEST_F(DeviceDisabledScreenTest, ShowWhenDisabledAndNotOwned) { 180 TEST_F(DeviceDisabledScreenTest, ShowWhenDisabledAndNotOwned) {
177 SetDeviceDisabled(true); 181 SetDeviceDisabled(true);
178 ExpectScreenToShow(); 182 ExpectScreenToShow();
179 TryToShowScreen(); 183 TryToShowScreen();
180 } 184 }
181 185
182 } // namespace chromeos 186 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698