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" |
11 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
12 #include "base/prefs/testing_pref_service.h" | 12 #include "base/prefs/testing_pref_service.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "chrome/browser/browser_process_platform_part.h" | 14 #include "chrome/browser/browser_process_platform_part.h" |
15 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | |
16 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
17 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
18 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 17 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
19 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" | 18 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" |
20 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 19 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" |
21 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 20 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
22 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 21 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
23 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
24 #include "chrome/test/base/testing_browser_process.h" | 23 #include "chrome/test/base/testing_browser_process.h" |
25 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
26 #include "components/ownership/mock_owner_key_util.h" | 25 #include "components/ownership/mock_owner_key_util.h" |
27 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 26 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 27 #include "components/user_manager/fake_user_manager.h" |
28 #include "content/public/test/test_browser_thread_bundle.h" | 28 #include "content/public/test/test_browser_thread_bundle.h" |
29 #include "policy/proto/device_management_backend.pb.h" | 29 #include "policy/proto/device_management_backend.pb.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
32 | 32 |
33 using testing::_; | 33 using testing::_; |
34 using testing::Mock; | 34 using testing::Mock; |
35 | 35 |
36 namespace chromeos { | 36 namespace chromeos { |
37 namespace system { | 37 namespace system { |
(...skipping 28 matching lines...) Expand all Loading... |
66 MOCK_METHOD0(ShowDeviceDisabledScreen, void()); | 66 MOCK_METHOD0(ShowDeviceDisabledScreen, void()); |
67 | 67 |
68 DeviceDisablingManager* GetDeviceDisablingManager() { | 68 DeviceDisablingManager* GetDeviceDisablingManager() { |
69 return device_disabling_manager_.get(); | 69 return device_disabling_manager_.get(); |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 policy::ScopedStubEnterpriseInstallAttributes install_attributes_; | 73 policy::ScopedStubEnterpriseInstallAttributes install_attributes_; |
74 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 74 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
75 chromeos::ScopedTestCrosSettings test_cros_settings_; | 75 chromeos::ScopedTestCrosSettings test_cros_settings_; |
76 FakeUserManager fake_user_manager_; | 76 user_manager::FakeUserManager fake_user_manager_; |
77 scoped_ptr<DeviceDisablingManager> device_disabling_manager_; | 77 scoped_ptr<DeviceDisablingManager> device_disabling_manager_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerTestBase); | 79 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerTestBase); |
80 }; | 80 }; |
81 | 81 |
82 DeviceDisablingManagerTestBase::DeviceDisablingManagerTestBase() | 82 DeviceDisablingManagerTestBase::DeviceDisablingManagerTestBase() |
83 : install_attributes_("", "", "", policy::DEVICE_MODE_NOT_SET) { | 83 : install_attributes_("", "", "", policy::DEVICE_MODE_NOT_SET) { |
84 } | 84 } |
85 | 85 |
86 void DeviceDisablingManagerTestBase::TearDown() { | 86 void DeviceDisablingManagerTestBase::TearDown() { |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |