| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "chrome/browser/browser_process_platform_part.h" | 13 #include "chrome/browser/browser_process_platform_part.h" |
| 14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 16 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 16 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 17 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" | 17 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" |
| 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 19 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 19 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 20 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" | 20 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
| 23 #include "chromeos/chromeos_switches.h" | 23 #include "chromeos/chromeos_switches.h" |
| 24 #include "components/ownership/mock_owner_key_util.h" | 24 #include "components/ownership/mock_owner_key_util.h" |
| 25 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 25 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 26 #include "components/policy/proto/device_management_backend.pb.h" | 26 #include "components/policy/proto/device_management_backend.pb.h" |
| 27 #include "components/prefs/scoped_user_pref_update.h" | 27 #include "components/prefs/scoped_user_pref_update.h" |
| 28 #include "components/prefs/testing_pref_service.h" | 28 #include "components/prefs/testing_pref_service.h" |
| 29 #include "components/user_manager/fake_user_manager.h" | |
| 30 #include "content/public/test/test_browser_thread_bundle.h" | 29 #include "content/public/test/test_browser_thread_bundle.h" |
| 31 #include "testing/gmock/include/gmock/gmock.h" | 30 #include "testing/gmock/include/gmock/gmock.h" |
| 32 #include "testing/gtest/include/gtest/gtest.h" | 31 #include "testing/gtest/include/gtest/gtest.h" |
| 33 | 32 |
| 34 using testing::_; | 33 using testing::_; |
| 35 using testing::Mock; | 34 using testing::Mock; |
| 36 | 35 |
| 37 namespace chromeos { | 36 namespace chromeos { |
| 38 namespace system { | 37 namespace system { |
| 39 | 38 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 70 void SetUnowned(); | 69 void SetUnowned(); |
| 71 void SetEnterpriseOwned(); | 70 void SetEnterpriseOwned(); |
| 72 void SetConsumerOwned(); | 71 void SetConsumerOwned(); |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 chromeos::StubInstallAttributes* GetInstallAttributes(); | 74 chromeos::StubInstallAttributes* GetInstallAttributes(); |
| 76 | 75 |
| 77 chromeos::ScopedStubInstallAttributes install_attributes_; | 76 chromeos::ScopedStubInstallAttributes install_attributes_; |
| 78 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 77 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
| 79 chromeos::ScopedTestCrosSettings test_cros_settings_; | 78 chromeos::ScopedTestCrosSettings test_cros_settings_; |
| 80 user_manager::FakeUserManager fake_user_manager_; | 79 chromeos::FakeChromeUserManager fake_user_manager_; |
| 81 std::unique_ptr<DeviceDisablingManager> device_disabling_manager_; | 80 std::unique_ptr<DeviceDisablingManager> device_disabling_manager_; |
| 82 | 81 |
| 83 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerTestBase); | 82 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManagerTestBase); |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 DeviceDisablingManagerTestBase::DeviceDisablingManagerTestBase() | 85 DeviceDisablingManagerTestBase::DeviceDisablingManagerTestBase() |
| 87 : install_attributes_(ScopedStubInstallAttributes::CreateUnset()) { | 86 : install_attributes_(ScopedStubInstallAttributes::CreateUnset()) { |
| 88 } | 87 } |
| 89 | 88 |
| 90 void DeviceDisablingManagerTestBase::TearDown() { | 89 void DeviceDisablingManagerTestBase::TearDown() { |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); | 493 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); |
| 495 | 494 |
| 496 // Not enterprise owned, disabled by flag. | 495 // Not enterprise owned, disabled by flag. |
| 497 SetUnowned(); | 496 SetUnowned(); |
| 498 EXPECT_FALSE( | 497 EXPECT_FALSE( |
| 499 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); | 498 DeviceDisablingManager::HonorDeviceDisablingDuringNormalOperation()); |
| 500 } | 499 } |
| 501 | 500 |
| 502 } // namespace system | 501 } // namespace system |
| 503 } // namespace chromeos | 502 } // namespace chromeos |
| OLD | NEW |