| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/device_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "chromeos/dbus/dbus_thread_manager.h" | 36 #include "chromeos/dbus/dbus_thread_manager.h" |
| 37 #include "chromeos/dbus/fake_cryptohome_client.h" | 37 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 38 #include "chromeos/dbus/fake_session_manager_client.h" | 38 #include "chromeos/dbus/fake_session_manager_client.h" |
| 39 #include "chromeos/system/fake_statistics_provider.h" | 39 #include "chromeos/system/fake_statistics_provider.h" |
| 40 #include "chromeos/system/statistics_provider.h" | 40 #include "chromeos/system/statistics_provider.h" |
| 41 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 41 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 42 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 42 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 43 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 43 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
| 44 #include "components/policy/core/common/cloud/mock_device_management_service.h" | 44 #include "components/policy/core/common/cloud/mock_device_management_service.h" |
| 45 #include "components/policy/core/common/external_data_fetcher.h" | 45 #include "components/policy/core/common/external_data_fetcher.h" |
| 46 #include "components/policy/core/common/policy_types.h" |
| 46 #include "components/policy/core/common/schema_registry.h" | 47 #include "components/policy/core/common/schema_registry.h" |
| 47 #include "google_apis/gaia/gaia_oauth_client.h" | 48 #include "google_apis/gaia/gaia_oauth_client.h" |
| 48 #include "net/url_request/test_url_fetcher_factory.h" | 49 #include "net/url_request/test_url_fetcher_factory.h" |
| 49 #include "net/url_request/url_request_test_util.h" | 50 #include "net/url_request/url_request_test_util.h" |
| 50 #include "policy/policy_constants.h" | 51 #include "policy/policy_constants.h" |
| 51 #include "policy/proto/device_management_backend.pb.h" | 52 #include "policy/proto/device_management_backend.pb.h" |
| 52 #include "testing/gmock/include/gmock/gmock.h" | 53 #include "testing/gmock/include/gmock/gmock.h" |
| 53 #include "testing/gtest/include/gtest/gtest.h" | 54 #include "testing/gtest/include/gtest/gtest.h" |
| 54 | 55 |
| 55 using testing::AnyNumber; | 56 using testing::AnyNumber; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 &state_keys_broker_, store_, manager_.get())); | 178 &state_keys_broker_, store_, manager_.get())); |
| 178 initializer_->Init(); | 179 initializer_->Init(); |
| 179 } | 180 } |
| 180 | 181 |
| 181 void VerifyPolicyPopulated() { | 182 void VerifyPolicyPopulated() { |
| 182 PolicyBundle bundle; | 183 PolicyBundle bundle; |
| 183 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 184 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
| 184 .Set(key::kDeviceMetricsReportingEnabled, | 185 .Set(key::kDeviceMetricsReportingEnabled, |
| 185 POLICY_LEVEL_MANDATORY, | 186 POLICY_LEVEL_MANDATORY, |
| 186 POLICY_SCOPE_MACHINE, | 187 POLICY_SCOPE_MACHINE, |
| 188 POLICY_SOURCE_CLOUD, |
| 187 new base::FundamentalValue(false), | 189 new base::FundamentalValue(false), |
| 188 NULL); | 190 NULL); |
| 189 EXPECT_TRUE(manager_->policies().Equals(bundle)); | 191 EXPECT_TRUE(manager_->policies().Equals(bundle)); |
| 190 } | 192 } |
| 191 | 193 |
| 192 void AllowUninterestingRemoteCommandFetches() { | 194 void AllowUninterestingRemoteCommandFetches() { |
| 193 // We are not interested in remote command fetches that the client initiates | 195 // We are not interested in remote command fetches that the client initiates |
| 194 // automatically. Make them fail and ignore them otherwise. | 196 // automatically. Make them fail and ignore them otherwise. |
| 195 EXPECT_CALL(device_management_service_, | 197 EXPECT_CALL(device_management_service_, |
| 196 CreateJob(DeviceManagementRequestJob::TYPE_REMOTE_COMMANDS, _)) | 198 CreateJob(DeviceManagementRequestJob::TYPE_REMOTE_COMMANDS, _)) |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 744 |
| 743 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, | 745 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, |
| 744 RobotRefreshSaveFailed) { | 746 RobotRefreshSaveFailed) { |
| 745 // Without the system salt, the robot token can't be stored. | 747 // Without the system salt, the robot token can't be stored. |
| 746 RunTest(); | 748 RunTest(); |
| 747 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); | 749 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); |
| 748 } | 750 } |
| 749 | 751 |
| 750 } // namespace | 752 } // namespace |
| 751 } // namespace policy | 753 } // namespace policy |
| OLD | NEW |