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" | |
47 #include "components/policy/core/common/schema_registry.h" | 46 #include "components/policy/core/common/schema_registry.h" |
48 #include "google_apis/gaia/gaia_oauth_client.h" | 47 #include "google_apis/gaia/gaia_oauth_client.h" |
49 #include "net/url_request/test_url_fetcher_factory.h" | 48 #include "net/url_request/test_url_fetcher_factory.h" |
50 #include "net/url_request/url_request_test_util.h" | 49 #include "net/url_request/url_request_test_util.h" |
51 #include "policy/policy_constants.h" | 50 #include "policy/policy_constants.h" |
52 #include "policy/proto/device_management_backend.pb.h" | 51 #include "policy/proto/device_management_backend.pb.h" |
53 #include "testing/gmock/include/gmock/gmock.h" | 52 #include "testing/gmock/include/gmock/gmock.h" |
54 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
55 | 54 |
56 using testing::AnyNumber; | 55 using testing::AnyNumber; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 &state_keys_broker_, store_, manager_.get())); | 177 &state_keys_broker_, store_, manager_.get())); |
179 initializer_->Init(); | 178 initializer_->Init(); |
180 } | 179 } |
181 | 180 |
182 void VerifyPolicyPopulated() { | 181 void VerifyPolicyPopulated() { |
183 PolicyBundle bundle; | 182 PolicyBundle bundle; |
184 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 183 bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
185 .Set(key::kDeviceMetricsReportingEnabled, | 184 .Set(key::kDeviceMetricsReportingEnabled, |
186 POLICY_LEVEL_MANDATORY, | 185 POLICY_LEVEL_MANDATORY, |
187 POLICY_SCOPE_MACHINE, | 186 POLICY_SCOPE_MACHINE, |
188 POLICY_SOURCE_CLOUD, | |
189 new base::FundamentalValue(false), | 187 new base::FundamentalValue(false), |
190 NULL); | 188 NULL); |
191 EXPECT_TRUE(manager_->policies().Equals(bundle)); | 189 EXPECT_TRUE(manager_->policies().Equals(bundle)); |
192 } | 190 } |
193 | 191 |
194 void AllowUninterestingRemoteCommandFetches() { | 192 void AllowUninterestingRemoteCommandFetches() { |
195 // We are not interested in remote command fetches that the client initiates | 193 // We are not interested in remote command fetches that the client initiates |
196 // automatically. Make them fail and ignore them otherwise. | 194 // automatically. Make them fail and ignore them otherwise. |
197 EXPECT_CALL(device_management_service_, | 195 EXPECT_CALL(device_management_service_, |
198 CreateJob(DeviceManagementRequestJob::TYPE_REMOTE_COMMANDS, _)) | 196 CreateJob(DeviceManagementRequestJob::TYPE_REMOTE_COMMANDS, _)) |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 | 742 |
745 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, | 743 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, |
746 RobotRefreshSaveFailed) { | 744 RobotRefreshSaveFailed) { |
747 // Without the system salt, the robot token can't be stored. | 745 // Without the system salt, the robot token can't be stored. |
748 RunTest(); | 746 RunTest(); |
749 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); | 747 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); |
750 } | 748 } |
751 | 749 |
752 } // namespace | 750 } // namespace |
753 } // namespace policy | 751 } // namespace policy |
OLD | NEW |