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 "chrome/browser/chromeos/system/device_disabling_manager.h" | 5 #include "chrome/browser/chromeos/system/device_disabling_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 // explicitly marked as not disabled. | 195 // explicitly marked as not disabled. |
196 TEST_F(DeviceDisablingManagerOOBETest, NotDisabledWhenExplicitlyNotDisabled) { | 196 TEST_F(DeviceDisablingManagerOOBETest, NotDisabledWhenExplicitlyNotDisabled) { |
197 SetDeviceDisabled(false); | 197 SetDeviceDisabled(false); |
198 CheckWhetherDeviceDisabledDuringOOBE(); | 198 CheckWhetherDeviceDisabledDuringOOBE(); |
199 EXPECT_FALSE(device_disabled()); | 199 EXPECT_FALSE(device_disabled()); |
200 } | 200 } |
201 | 201 |
202 // Verifies that the device is not considered disabled during OOBE when device | 202 // Verifies that the device is not considered disabled during OOBE when device |
203 // disabling is turned off by flag, even if the device is marked as disabled. | 203 // disabling is turned off by flag, even if the device is marked as disabled. |
204 TEST_F(DeviceDisablingManagerOOBETest, NotDisabledWhenTurnedOffByFlag) { | 204 TEST_F(DeviceDisablingManagerOOBETest, NotDisabledWhenTurnedOffByFlag) { |
205 CommandLine::ForCurrentProcess()->AppendSwitch( | 205 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
206 switches::kDisableDeviceDisabling); | 206 switches::kDisableDeviceDisabling); |
207 SetDeviceDisabled(true); | 207 SetDeviceDisabled(true); |
208 CheckWhetherDeviceDisabledDuringOOBE(); | 208 CheckWhetherDeviceDisabledDuringOOBE(); |
209 EXPECT_FALSE(device_disabled()); | 209 EXPECT_FALSE(device_disabled()); |
210 } | 210 } |
211 | 211 |
212 // Verifies that the device is not considered disabled during OOBE when it is | 212 // Verifies that the device is not considered disabled during OOBE when it is |
213 // already enrolled, even if the device is marked as disabled. | 213 // already enrolled, even if the device is marked as disabled. |
214 TEST_F(DeviceDisablingManagerOOBETest, NotDisabledWhenEnterpriseOwned) { | 214 TEST_F(DeviceDisablingManagerOOBETest, NotDisabledWhenEnterpriseOwned) { |
215 UpdateInstallAttributes(kEnrollmentDomain, | 215 UpdateInstallAttributes(kEnrollmentDomain, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 EXPECT_CALL(*this, RestartToLoginScreen()).Times(0); | 369 EXPECT_CALL(*this, RestartToLoginScreen()).Times(0); |
370 EXPECT_CALL(*this, ShowDeviceDisabledScreen()).Times(0); | 370 EXPECT_CALL(*this, ShowDeviceDisabledScreen()).Times(0); |
371 EXPECT_CALL(*this, OnDisabledMessageChanged(_)).Times(0); | 371 EXPECT_CALL(*this, OnDisabledMessageChanged(_)).Times(0); |
372 CreateDeviceDisablingManager(); | 372 CreateDeviceDisablingManager(); |
373 } | 373 } |
374 | 374 |
375 // Verifies that the device is not considered disabled when device disabling is | 375 // Verifies that the device is not considered disabled when device disabling is |
376 // turned off by flag, even if the device is marked as disabled. | 376 // turned off by flag, even if the device is marked as disabled. |
377 TEST_F(DeviceDisablingManagerTest, NotDisabledWhenTurnedOffByFlag) { | 377 TEST_F(DeviceDisablingManagerTest, NotDisabledWhenTurnedOffByFlag) { |
378 CommandLine::ForCurrentProcess()->AppendSwitch( | 378 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
379 switches::kDisableDeviceDisabling); | 379 switches::kDisableDeviceDisabling); |
380 SetEnterpriseOwned(); | 380 SetEnterpriseOwned(); |
381 MakeCrosSettingsTrusted(); | 381 MakeCrosSettingsTrusted(); |
382 SetDeviceDisabled(true); | 382 SetDeviceDisabled(true); |
383 | 383 |
384 EXPECT_CALL(*this, RestartToLoginScreen()).Times(0); | 384 EXPECT_CALL(*this, RestartToLoginScreen()).Times(0); |
385 EXPECT_CALL(*this, ShowDeviceDisabledScreen()).Times(0); | 385 EXPECT_CALL(*this, ShowDeviceDisabledScreen()).Times(0); |
386 EXPECT_CALL(*this, OnDisabledMessageChanged(_)).Times(0); | 386 EXPECT_CALL(*this, OnDisabledMessageChanged(_)).Times(0); |
387 CreateDeviceDisablingManager(); | 387 CreateDeviceDisablingManager(); |
388 } | 388 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // Not enterprise owned, not disabled by flag. | 493 // Not enterprise owned, not disabled by flag. |
494 EXPECT_FALSE( | 494 EXPECT_FALSE( |
495 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); | 495 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); |
496 | 496 |
497 // Enterprise owned, not disabled by flag. | 497 // Enterprise owned, not disabled by flag. |
498 SetEnterpriseOwned(); | 498 SetEnterpriseOwned(); |
499 EXPECT_TRUE( | 499 EXPECT_TRUE( |
500 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); | 500 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); |
501 | 501 |
502 // Enterprise owned, disabled by flag. | 502 // Enterprise owned, disabled by flag. |
503 CommandLine::ForCurrentProcess()->AppendSwitch( | 503 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
504 switches::kDisableDeviceDisabling); | 504 switches::kDisableDeviceDisabling); |
505 EXPECT_FALSE( | 505 EXPECT_FALSE( |
506 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); | 506 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); |
507 | 507 |
508 // Not enterprise owned, disabled by flag. | 508 // Not enterprise owned, disabled by flag. |
509 SetUnowned(); | 509 SetUnowned(); |
510 EXPECT_FALSE( | 510 EXPECT_FALSE( |
511 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); | 511 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); |
512 } | 512 } |
513 | 513 |
514 } // namespace system | 514 } // namespace system |
515 } // namespace chromeos | 515 } // namespace chromeos |
OLD | NEW |