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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 | 131 |
132 return base::StringPrintf(kTestPolicy, | 132 return base::StringPrintf(kTestPolicy, |
133 dm_protocol::kChromeUserPolicyType, | 133 dm_protocol::kChromeUserPolicyType, |
134 homepage, | 134 homepage, |
135 GetTestUser(), | 135 GetTestUser(), |
136 key_version); | 136 key_version); |
137 } | 137 } |
138 | 138 |
139 void GetExpectedDefaultPolicy(PolicyMap* policy_map) { | 139 void GetExpectedDefaultPolicy(PolicyMap* policy_map) { |
140 #if defined(OS_CHROMEOS) | 140 #if defined(OS_CHROMEOS) |
141 policy_map->Set( | 141 policy_map->Set(key::kChromeOsMultiProfileUserBehavior, |
sky
2014/07/11 22:54:47
nit: I tend to think imposing your favorite style
Evan Stade
2014/07/11 22:56:27
I actually just ran the file (and all files in thi
| |
142 key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY, | 142 POLICY_LEVEL_MANDATORY, |
143 POLICY_SCOPE_USER, base::Value::CreateStringValue("primary-only"), NULL); | 143 POLICY_SCOPE_USER, |
144 new base::StringValue("primary-only"), | |
145 NULL); | |
144 #endif | 146 #endif |
145 } | 147 } |
146 | 148 |
147 void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { | 149 void GetExpectedTestPolicy(PolicyMap* expected, const char* homepage) { |
148 expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 150 expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
149 base::Value::CreateBooleanValue(true), NULL); | 151 base::Value::CreateBooleanValue(true), NULL); |
150 expected->Set(key::kRestoreOnStartup, POLICY_LEVEL_MANDATORY, | 152 expected->Set(key::kRestoreOnStartup, POLICY_LEVEL_MANDATORY, |
151 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(4), NULL); | 153 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(4), NULL); |
152 base::ListValue list; | 154 base::ListValue list; |
153 list.AppendString("dev.chromium.org"); | 155 list.AppendString("dev.chromium.org"); |
154 list.AppendString("youtube.com"); | 156 list.AppendString("youtube.com"); |
155 expected->Set( | 157 expected->Set( |
156 key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 158 key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
157 list.DeepCopy(), NULL); | 159 list.DeepCopy(), NULL); |
158 expected->Set( | 160 expected->Set( |
159 key::kMaxInvalidationFetchDelay, POLICY_LEVEL_MANDATORY, | 161 key::kMaxInvalidationFetchDelay, POLICY_LEVEL_MANDATORY, |
160 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(1000), NULL); | 162 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(1000), NULL); |
161 expected->Set( | 163 expected->Set(key::kHomepageLocation, |
162 key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED, | 164 POLICY_LEVEL_RECOMMENDED, |
163 POLICY_SCOPE_USER, base::Value::CreateStringValue(homepage), NULL); | 165 POLICY_SCOPE_USER, |
166 new base::StringValue(homepage), | |
167 NULL); | |
164 #if defined(OS_CHROMEOS) | 168 #if defined(OS_CHROMEOS) |
165 expected->Set( | 169 expected->Set(key::kChromeOsMultiProfileUserBehavior, |
166 key::kChromeOsMultiProfileUserBehavior, POLICY_LEVEL_MANDATORY, | 170 POLICY_LEVEL_MANDATORY, |
167 POLICY_SCOPE_USER, base::Value::CreateStringValue("primary-only"), NULL); | 171 POLICY_SCOPE_USER, |
172 new base::StringValue("primary-only"), | |
173 NULL); | |
168 #endif | 174 #endif |
169 } | 175 } |
170 | 176 |
171 } // namespace | 177 } // namespace |
172 | 178 |
173 // Tests the cloud policy stack(s). | 179 // Tests the cloud policy stack(s). |
174 class CloudPolicyTest : public InProcessBrowserTest, | 180 class CloudPolicyTest : public InProcessBrowserTest, |
175 public PolicyService::Observer { | 181 public PolicyService::Observer { |
176 protected: | 182 protected: |
177 CloudPolicyTest() {} | 183 CloudPolicyTest() {} |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
459 | 465 |
460 // They should now serialize to the same bytes. | 466 // They should now serialize to the same bytes. |
461 std::string chrome_settings_serialized; | 467 std::string chrome_settings_serialized; |
462 std::string cloud_policy_serialized; | 468 std::string cloud_policy_serialized; |
463 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 469 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
464 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 470 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
465 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 471 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
466 } | 472 } |
467 | 473 |
468 } // namespace policy | 474 } // namespace policy |
OLD | NEW |