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/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 base::UTF8ToUTF16(""), 0, std::string(), factories); | 104 base::UTF8ToUTF16(""), 0, std::string(), factories); |
105 // Usually the signin Profile and the main Profile are separate, but since | 105 // Usually the signin Profile and the main Profile are separate, but since |
106 // the signin Profile is an OTR Profile then for this test it suffices to | 106 // the signin Profile is an OTR Profile then for this test it suffices to |
107 // attach it to the main Profile. | 107 // attach it to the main Profile. |
108 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); | 108 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); |
109 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); | 109 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); |
110 | 110 |
111 chrome::RegisterLocalState(prefs_.registry()); | 111 chrome::RegisterLocalState(prefs_.registry()); |
112 | 112 |
113 // Set up a policy map for testing. | 113 // Set up a policy map for testing. |
114 policy_map_.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY, | 114 policy_map_.Set( |
115 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 115 key::kHomepageLocation, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
116 new base::StringValue("http://chromium.org"), nullptr); | 116 POLICY_SOURCE_CLOUD, |
117 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, | 117 base::WrapUnique(new base::StringValue("http://chromium.org")), |
118 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 118 nullptr); |
119 POLICY_SOURCE_ENTERPRISE_DEFAULT, | 119 policy_map_.Set( |
120 new base::StringValue("primary-only"), nullptr); | 120 key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY, |
| 121 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT, |
| 122 base::WrapUnique(new base::StringValue("primary-only")), nullptr); |
121 policy_map_.Set(key::kEasyUnlockAllowed, POLICY_LEVEL_MANDATORY, | 123 policy_map_.Set(key::kEasyUnlockAllowed, POLICY_LEVEL_MANDATORY, |
122 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 124 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
123 new base::FundamentalValue(false), nullptr); | 125 base::WrapUnique(new base::FundamentalValue(false)), |
124 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, | |
125 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | |
126 POLICY_SOURCE_CLOUD, new base::FundamentalValue(false), | |
127 nullptr); | 126 nullptr); |
| 127 policy_map_.Set( |
| 128 key::kCaptivePortalAuthenticationIgnoresProxy, POLICY_LEVEL_MANDATORY, |
| 129 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, |
| 130 base::WrapUnique(new base::FundamentalValue(false)), nullptr); |
128 policy_map_.Set(key::kAllowDinosaurEasterEgg, POLICY_LEVEL_MANDATORY, | 131 policy_map_.Set(key::kAllowDinosaurEasterEgg, POLICY_LEVEL_MANDATORY, |
129 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT, | 132 POLICY_SCOPE_USER, POLICY_SOURCE_ENTERPRISE_DEFAULT, |
130 new base::FundamentalValue(false), nullptr); | 133 base::WrapUnique(new base::FundamentalValue(false)), |
| 134 nullptr); |
131 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 135 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
132 .CopyFrom(policy_map_); | 136 .CopyFrom(policy_map_); |
133 | 137 |
134 // Create fake policy blobs to deliver to the client. | 138 // Create fake policy blobs to deliver to the client. |
135 em::DeviceRegisterResponse* register_response = | 139 em::DeviceRegisterResponse* register_response = |
136 register_blob_.mutable_register_response(); | 140 register_blob_.mutable_register_response(); |
137 register_response->set_device_management_token("dmtoken123"); | 141 register_response->set_device_management_token("dmtoken123"); |
138 | 142 |
139 em::CloudPolicySettings policy_proto; | 143 em::CloudPolicySettings policy_proto; |
140 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org"); | 144 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org"); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 598 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
595 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 599 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
596 | 600 |
597 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 601 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
598 // Running the task runner issues the initial fetch. | 602 // Running the task runner issues the initial fetch. |
599 FetchPolicy( | 603 FetchPolicy( |
600 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 604 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
601 } | 605 } |
602 | 606 |
603 } // namespace policy | 607 } // namespace policy |
OLD | NEW |