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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 factories); | 105 factories); |
106 // Usually the signin Profile and the main Profile are separate, but since | 106 // Usually the signin Profile and the main Profile are separate, but since |
107 // the signin Profile is an OTR Profile then for this test it suffices to | 107 // the signin Profile is an OTR Profile then for this test it suffices to |
108 // attach it to the main Profile. | 108 // attach it to the main Profile. |
109 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); | 109 signin_profile_ = TestingProfile::Builder().BuildIncognito(profile_); |
110 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); | 110 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); |
111 | 111 |
112 chrome::RegisterLocalState(prefs_.registry()); | 112 chrome::RegisterLocalState(prefs_.registry()); |
113 | 113 |
114 // Set up a policy map for testing. | 114 // Set up a policy map for testing. |
115 policy_map_.Set(key::kHomepageLocation, | 115 policy_map_.Set(key::kHomepageLocation, POLICY_LEVEL_MANDATORY, |
Thiemo Nagel
2015/09/01 17:40:36
Don't reformat!
fhorschig
2015/09/04 06:53:53
Done.
| |
116 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 116 POLICY_SCOPE_USER, |
117 new base::StringValue("http://chromium.org"), | 117 new base::StringValue("http://chromium.org"), NULL, |
118 NULL); | 118 POLICY_SOURCE_CLOUD); |
119 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, | 119 policy_map_.Set(key::kChromeOsMultiProfileUserBehavior, |
120 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 120 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
121 new base::StringValue("primary-only"), | 121 new base::StringValue("primary-only"), NULL, |
122 NULL); | 122 POLICY_SOURCE_ENTERPRISE_DEFAULT); |
123 policy_map_.Set(key::kEasyUnlockAllowed, | 123 policy_map_.Set(key::kEasyUnlockAllowed, POLICY_LEVEL_MANDATORY, |
124 POLICY_SCOPE_USER, new base::FundamentalValue(false), NULL, | |
125 POLICY_SOURCE_CLOUD); | |
126 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, | |
124 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 127 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
125 new base::FundamentalValue(false), | 128 new base::FundamentalValue(false), NULL, |
126 NULL); | 129 POLICY_SOURCE_CLOUD); |
127 policy_map_.Set(key::kCaptivePortalAuthenticationIgnoresProxy, | |
128 POLICY_LEVEL_MANDATORY, | |
129 POLICY_SCOPE_USER, | |
130 new base::FundamentalValue(false), | |
131 NULL); | |
132 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 130 expected_bundle_.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
133 .CopyFrom(policy_map_); | 131 .CopyFrom(policy_map_); |
134 | 132 |
135 // Create fake policy blobs to deliver to the client. | 133 // Create fake policy blobs to deliver to the client. |
136 em::DeviceRegisterResponse* register_response = | 134 em::DeviceRegisterResponse* register_response = |
137 register_blob_.mutable_register_response(); | 135 register_blob_.mutable_register_response(); |
138 register_response->set_device_management_token("dmtoken123"); | 136 register_response->set_device_management_token("dmtoken123"); |
139 | 137 |
140 em::CloudPolicySettings policy_proto; | 138 em::CloudPolicySettings policy_proto; |
141 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org"); | 139 policy_proto.mutable_homepagelocation()->set_value("http://chromium.org"); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 586 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
589 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 587 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
590 | 588 |
591 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 589 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
592 // Running the task runner issues the initial fetch. | 590 // Running the task runner issues the initial fetch. |
593 FetchPolicy( | 591 FetchPolicy( |
594 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 592 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
595 } | 593 } |
596 | 594 |
597 } // namespace policy | 595 } // namespace policy |
OLD | NEW |