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/base_paths.h" | 5 #include "base/base_paths.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/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/public/test/test_utils.h" | 30 #include "content/public/test/test_utils.h" |
31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
32 #include "net/test/test_server.h" | 32 #include "net/test/test_server.h" |
33 #include "policy/policy_constants.h" | 33 #include "policy/policy_constants.h" |
34 #include "testing/gmock/include/gmock/gmock.h" | 34 #include "testing/gmock/include/gmock/gmock.h" |
35 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
36 | 36 |
37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
38 #include "chrome/browser/chromeos/login/user_manager.h" | 38 #include "chrome/browser/chromeos/login/user_manager.h" |
39 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h" | 39 #include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h" |
40 #include "chrome/common/chrome_paths.h" | |
41 #include "chromeos/dbus/mock_cryptohome_client.h" | |
42 #include "chromeos/dbus/mock_dbus_thread_manager.h" | |
43 #include "chromeos/dbus/mock_session_manager_client.h" | |
44 #else | 40 #else |
45 #include "chrome/browser/policy/user_cloud_policy_manager.h" | 41 #include "chrome/browser/policy/user_cloud_policy_manager.h" |
46 #include "chrome/browser/policy/user_cloud_policy_manager_factory.h" | 42 #include "chrome/browser/policy/user_cloud_policy_manager_factory.h" |
47 #include "chrome/browser/signin/signin_manager.h" | 43 #include "chrome/browser/signin/signin_manager.h" |
48 #include "chrome/browser/signin/signin_manager_factory.h" | 44 #include "chrome/browser/signin/signin_manager_factory.h" |
49 #endif | 45 #endif |
50 | 46 |
51 using testing::AnyNumber; | |
52 using testing::InvokeWithoutArgs; | 47 using testing::InvokeWithoutArgs; |
53 using testing::Mock; | 48 using testing::Mock; |
54 using testing::_; | 49 using testing::_; |
55 | 50 |
56 namespace em = enterprise_management; | 51 namespace em = enterprise_management; |
57 | 52 |
58 namespace policy { | 53 namespace policy { |
59 | 54 |
60 namespace { | 55 namespace { |
61 | 56 |
62 class MockCloudPolicyClientObserver : public CloudPolicyClient::Observer { | 57 class MockCloudPolicyClientObserver : public CloudPolicyClient::Observer { |
63 public: | 58 public: |
64 MockCloudPolicyClientObserver() {} | 59 MockCloudPolicyClientObserver() {} |
65 virtual ~MockCloudPolicyClientObserver() {} | 60 virtual ~MockCloudPolicyClientObserver() {} |
66 | 61 |
67 MOCK_METHOD1(OnPolicyFetched, void(CloudPolicyClient*)); | 62 MOCK_METHOD1(OnPolicyFetched, void(CloudPolicyClient*)); |
68 MOCK_METHOD1(OnRegistrationStateChanged, void(CloudPolicyClient*)); | 63 MOCK_METHOD1(OnRegistrationStateChanged, void(CloudPolicyClient*)); |
69 MOCK_METHOD1(OnClientError, void(CloudPolicyClient*)); | 64 MOCK_METHOD1(OnClientError, void(CloudPolicyClient*)); |
70 }; | 65 }; |
71 | 66 |
72 #if defined(OS_CHROMEOS) | |
73 | |
74 const char kSanitizedUsername[] = "0123456789ABCDEF0123456789ABCDEF01234567"; | |
75 | |
76 ACTION(GetSanitizedUsername) { | |
77 MessageLoop::current()->PostTask( | |
78 FROM_HERE, | |
79 base::Bind(arg1, chromeos::DBUS_METHOD_CALL_SUCCESS, kSanitizedUsername)); | |
80 } | |
81 | |
82 ACTION_P(RetrieveUserPolicy, storage) { | |
83 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(arg0, *storage)); | |
84 } | |
85 | |
86 ACTION_P2(StoreUserPolicy, storage, user_policy_key_file) { | |
87 // The session_manager stores a copy of the policy key at | |
88 // /var/run/user_policy/$hash/policy.pub. Simulate that behavior here, so | |
89 // that the policy signature can be validated. | |
90 em::PolicyFetchResponse policy; | |
91 ASSERT_TRUE(policy.ParseFromString(arg0)); | |
92 if (policy.has_new_public_key()) { | |
93 ASSERT_TRUE(file_util::CreateDirectory(user_policy_key_file.DirName())); | |
94 int result = file_util::WriteFile( | |
95 user_policy_key_file, | |
96 policy.new_public_key().data(), | |
97 policy.new_public_key().size()); | |
98 ASSERT_EQ(static_cast<int>(policy.new_public_key().size()), result); | |
99 } | |
100 | |
101 *storage = arg0; | |
102 MessageLoop::current()->PostTask(FROM_HERE, base::Bind(arg1, true)); | |
103 } | |
104 | |
105 #endif | |
106 | |
107 const char* GetTestUser() { | 67 const char* GetTestUser() { |
108 #if defined(OS_CHROMEOS) | 68 #if defined(OS_CHROMEOS) |
109 return chromeos::UserManager::kStubUser; | 69 return chromeos::UserManager::kStubUser; |
110 #else | 70 #else |
111 return "user@example.com"; | 71 return "user@example.com"; |
112 #endif | 72 #endif |
113 } | 73 } |
114 | 74 |
115 std::string GetEmptyPolicy() { | 75 std::string GetEmptyPolicy() { |
116 const char kEmptyPolicy[] = | 76 const char kEmptyPolicy[] = |
117 "{" | 77 "{" |
118 " \"%s\": {" | 78 " \"%s\": {" |
119 " \"mandatory\": {}," | 79 " \"mandatory\": {}," |
120 " \"recommended\": {}" | 80 " \"recommended\": {}" |
121 " }," | 81 " }," |
122 " \"managed_users\": [ \"*\" ]," | 82 " \"managed_users\": [ \"*\" ]," |
123 " \"policy_user\": \"%s\"," | 83 " \"policy_user\": \"%s\"" |
124 " \"current_key_index\": 0" | |
125 "}"; | 84 "}"; |
126 | 85 |
127 return base::StringPrintf( | 86 return base::StringPrintf(kEmptyPolicy, dm_protocol::kChromeUserPolicyType, |
128 kEmptyPolicy, dm_protocol::kChromeUserPolicyType, GetTestUser()); | 87 GetTestUser()); |
129 } | 88 } |
130 | 89 |
131 std::string GetTestPolicy(int key_version) { | 90 std::string GetTestPolicy() { |
132 const char kTestPolicy[] = | 91 const char kTestPolicy[] = |
133 "{" | 92 "{" |
134 " \"%s\": {" | 93 " \"%s\": {" |
135 " \"mandatory\": {" | 94 " \"mandatory\": {" |
136 " \"ShowHomeButton\": true," | 95 " \"ShowHomeButton\": true," |
137 " \"MaxConnectionsPerProxy\": 42," | 96 " \"MaxConnectionsPerProxy\": 42," |
138 " \"URLBlacklist\": [ \"dev.chromium.org\", \"youtube.com\" ]" | 97 " \"URLBlacklist\": [ \"dev.chromium.org\", \"youtube.com\" ]" |
139 " }," | 98 " }," |
140 " \"recommended\": {" | 99 " \"recommended\": {" |
141 " \"HomepageLocation\": \"google.com\"" | 100 " \"HomepageLocation\": \"google.com\"" |
142 " }" | 101 " }" |
143 " }," | 102 " }," |
144 " \"managed_users\": [ \"*\" ]," | 103 " \"managed_users\": [ \"*\" ]," |
145 " \"policy_user\": \"%s\"," | 104 " \"policy_user\": \"%s\"" |
146 " \"current_key_index\": %d" | |
147 "}"; | 105 "}"; |
148 | 106 |
149 return base::StringPrintf(kTestPolicy, | 107 return base::StringPrintf(kTestPolicy, dm_protocol::kChromeUserPolicyType, |
150 dm_protocol::kChromeUserPolicyType, | 108 GetTestUser()); |
151 GetTestUser(), | |
152 key_version); | |
153 } | |
154 | |
155 void GetExpectedTestPolicy(PolicyMap* expected) { | |
156 expected->Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | |
157 base::Value::CreateBooleanValue(true)); | |
158 expected->Set(key::kMaxConnectionsPerProxy, POLICY_LEVEL_MANDATORY, | |
159 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(42)); | |
160 base::ListValue list; | |
161 list.AppendString("dev.chromium.org"); | |
162 list.AppendString("youtube.com"); | |
163 expected->Set( | |
164 key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | |
165 list.DeepCopy()); | |
166 expected->Set( | |
167 key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED, | |
168 POLICY_SCOPE_USER, base::Value::CreateStringValue("google.com")); | |
169 } | 109 } |
170 | 110 |
171 } // namespace | 111 } // namespace |
172 | 112 |
173 // Tests the cloud policy stack(s). | 113 // Tests the cloud policy stack(s). |
174 class CloudPolicyTest : public InProcessBrowserTest { | 114 class CloudPolicyTest : public InProcessBrowserTest { |
175 protected: | 115 protected: |
176 CloudPolicyTest() {} | 116 CloudPolicyTest() {} |
177 virtual ~CloudPolicyTest() {} | 117 virtual ~CloudPolicyTest() {} |
178 | 118 |
179 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 119 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
180 // The TestServer wants the docroot as a path relative to the source dir. | 120 // The TestServer wants the docroot as a path relative to the source dir. |
181 base::FilePath source; | 121 base::FilePath source; |
182 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source)); | 122 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source)); |
183 ASSERT_TRUE(temp_dir_.CreateUniqueTempDirUnderPath(source)); | 123 ASSERT_TRUE(temp_dir_.CreateUniqueTempDirUnderPath(source)); |
184 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetEmptyPolicy())); | 124 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetEmptyPolicy())); |
185 | 125 |
186 test_server_.reset( | 126 test_server_.reset( |
187 new net::TestServer( | 127 new net::TestServer( |
188 net::TestServer::TYPE_HTTP, | 128 net::TestServer::TYPE_HTTP, |
189 net::TestServer::kLocalhost, | 129 net::TestServer::kLocalhost, |
190 testserver_relative_docroot())); | 130 temp_dir_.path().BaseName())); |
191 ASSERT_TRUE(test_server_->Start()); | 131 ASSERT_TRUE(test_server_->Start()); |
192 | 132 |
193 std::string url = test_server_->GetURL("device_management").spec(); | 133 std::string url = test_server_->GetURL("device_management").spec(); |
194 | 134 |
195 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 135 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
196 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); | 136 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, url); |
197 | |
198 #if defined(OS_CHROMEOS) | |
199 PathService::Override(chrome::DIR_USER_POLICY_KEYS, user_policy_key_dir()); | |
200 | |
201 mock_dbus_thread_manager_ = new chromeos::MockDBusThreadManager(); | |
202 chromeos::DBusThreadManager::InitializeForTesting( | |
203 mock_dbus_thread_manager_); | |
204 EXPECT_CALL(*mock_dbus_thread_manager_->mock_cryptohome_client(), | |
205 GetSanitizedUsername(_, _)) | |
206 .WillRepeatedly(GetSanitizedUsername()); | |
207 EXPECT_CALL(*mock_dbus_thread_manager_->mock_session_manager_client(), | |
208 StoreUserPolicy(_, _)) | |
209 .WillRepeatedly(StoreUserPolicy(&session_manager_user_policy_, | |
210 user_policy_key_file())); | |
211 EXPECT_CALL(*mock_dbus_thread_manager_->mock_session_manager_client(), | |
212 RetrieveUserPolicy(_)) | |
213 .WillRepeatedly(RetrieveUserPolicy(&session_manager_user_policy_)); | |
214 #endif | |
215 } | 137 } |
216 | 138 |
217 virtual void SetUpOnMainThread() OVERRIDE { | 139 virtual void SetUpOnMainThread() OVERRIDE { |
218 // Checks that no policies have been loaded by the other providers before | 140 // Checks that no policies have been loaded by the other providers before |
219 // setting up the cloud connection. Other policies configured in the test | 141 // setting up the cloud connection. Other policies configured in the test |
220 // machine will interfere with these tests. | 142 // machine will interfere with these tests. |
221 const PolicyMap& map = g_browser_process->policy_service()->GetPolicies( | 143 const PolicyMap& map = g_browser_process->policy_service()->GetPolicies( |
222 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); | 144 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); |
223 if (!map.empty()) { | 145 if (!map.empty()) { |
224 base::DictionaryValue dict; | 146 base::DictionaryValue dict; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 policy_manager->core()->client()->AddObserver(&observer); | 183 policy_manager->core()->client()->AddObserver(&observer); |
262 | 184 |
263 // Give a bogus OAuth token to the |policy_manager|. This should make its | 185 // Give a bogus OAuth token to the |policy_manager|. This should make its |
264 // CloudPolicyClient fetch the DMToken. | 186 // CloudPolicyClient fetch the DMToken. |
265 policy_manager->RegisterClient("bogus"); | 187 policy_manager->RegisterClient("bogus"); |
266 run_loop.Run(); | 188 run_loop.Run(); |
267 Mock::VerifyAndClearExpectations(&observer); | 189 Mock::VerifyAndClearExpectations(&observer); |
268 policy_manager->core()->client()->RemoveObserver(&observer); | 190 policy_manager->core()->client()->RemoveObserver(&observer); |
269 } | 191 } |
270 | 192 |
271 FilePath testserver_relative_docroot() { | |
272 return temp_dir_.path().BaseName().AppendASCII("testserver"); | |
273 } | |
274 | |
275 FilePath testserver_device_management_file() { | |
276 return temp_dir_.path().AppendASCII("testserver") | |
277 .AppendASCII("device_management"); | |
278 } | |
279 | |
280 #if defined(OS_CHROMEOS) | |
281 FilePath user_policy_key_dir() { | |
282 return temp_dir_.path().AppendASCII("user_policy"); | |
283 } | |
284 | |
285 FilePath user_policy_key_file() { | |
286 return user_policy_key_dir().AppendASCII(kSanitizedUsername) | |
287 .AppendASCII("policy.pub"); | |
288 } | |
289 #endif | |
290 | |
291 void SetServerPolicy(const std::string& policy) { | 193 void SetServerPolicy(const std::string& policy) { |
292 ASSERT_TRUE(file_util::CreateDirectory( | |
293 testserver_device_management_file().DirName())); | |
294 int result = file_util::WriteFile( | 194 int result = file_util::WriteFile( |
295 testserver_device_management_file(), policy.data(), policy.size()); | 195 temp_dir_.path().AppendASCII("device_management"), |
| 196 policy.data(), policy.size()); |
296 ASSERT_EQ(static_cast<int>(policy.size()), result); | 197 ASSERT_EQ(static_cast<int>(policy.size()), result); |
297 } | 198 } |
298 | 199 |
299 base::ScopedTempDir temp_dir_; | 200 base::ScopedTempDir temp_dir_; |
300 scoped_ptr<net::TestServer> test_server_; | 201 scoped_ptr<net::TestServer> test_server_; |
301 | |
302 #if defined(OS_CHROMEOS) | |
303 std::string session_manager_user_policy_; | |
304 chromeos::MockDBusThreadManager* mock_dbus_thread_manager_; | |
305 #endif | |
306 }; | 202 }; |
307 | 203 |
308 IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicy) { | 204 IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicy) { |
309 PolicyService* policy_service = browser()->profile()->GetPolicyService(); | 205 PolicyService* policy_service = browser()->profile()->GetPolicyService(); |
310 { | 206 { |
311 base::RunLoop run_loop; | 207 base::RunLoop run_loop; |
312 // This does the initial fetch and stores the initial key. | |
313 policy_service->RefreshPolicies(run_loop.QuitClosure()); | 208 policy_service->RefreshPolicies(run_loop.QuitClosure()); |
314 run_loop.Run(); | 209 run_loop.Run(); |
315 } | 210 } |
316 | 211 |
317 PolicyMap empty; | 212 PolicyMap empty; |
318 EXPECT_TRUE(empty.Equals(policy_service->GetPolicies( | 213 EXPECT_TRUE(empty.Equals(policy_service->GetPolicies( |
319 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); | 214 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); |
320 | 215 |
321 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetTestPolicy(0))); | 216 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetTestPolicy())); |
322 PolicyMap expected; | 217 PolicyMap expected; |
323 GetExpectedTestPolicy(&expected); | 218 expected.Set(key::kShowHomeButton, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 219 base::Value::CreateBooleanValue(true)); |
| 220 expected.Set(key::kMaxConnectionsPerProxy, POLICY_LEVEL_MANDATORY, |
| 221 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(42)); |
| 222 base::ListValue list; |
| 223 list.AppendString("dev.chromium.org"); |
| 224 list.AppendString("youtube.com"); |
| 225 expected.Set( |
| 226 key::kURLBlacklist, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 227 list.DeepCopy()); |
| 228 expected.Set( |
| 229 key::kHomepageLocation, POLICY_LEVEL_RECOMMENDED, |
| 230 POLICY_SCOPE_USER, base::Value::CreateStringValue("google.com")); |
324 { | 231 { |
325 base::RunLoop run_loop; | 232 base::RunLoop run_loop; |
326 // This fetches the new policies, using the same key. | |
327 policy_service->RefreshPolicies(run_loop.QuitClosure()); | 233 policy_service->RefreshPolicies(run_loop.QuitClosure()); |
328 run_loop.Run(); | 234 run_loop.Run(); |
329 } | 235 } |
330 EXPECT_TRUE(expected.Equals(policy_service->GetPolicies( | 236 EXPECT_TRUE(expected.Equals(policy_service->GetPolicies( |
331 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); | 237 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); |
332 } | 238 } |
333 | 239 |
334 #if defined(OS_CHROMEOS) | |
335 IN_PROC_BROWSER_TEST_F(CloudPolicyTest, FetchPolicyWithRotatedKey) { | |
336 PolicyService* policy_service = browser()->profile()->GetPolicyService(); | |
337 { | |
338 base::RunLoop run_loop; | |
339 // This does the initial fetch and stores the initial key. | |
340 policy_service->RefreshPolicies(run_loop.QuitClosure()); | |
341 run_loop.Run(); | |
342 } | |
343 | |
344 // Read the initial key. | |
345 std::string initial_key; | |
346 ASSERT_TRUE( | |
347 file_util::ReadFileToString(user_policy_key_file(), &initial_key)); | |
348 | |
349 PolicyMap empty; | |
350 EXPECT_TRUE(empty.Equals(policy_service->GetPolicies( | |
351 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); | |
352 | |
353 // Set the new policies and a new key at the server. | |
354 ASSERT_NO_FATAL_FAILURE(SetServerPolicy(GetTestPolicy(1))); | |
355 PolicyMap expected; | |
356 GetExpectedTestPolicy(&expected); | |
357 { | |
358 base::RunLoop run_loop; | |
359 // This fetches the new policies and does a key rotation. | |
360 policy_service->RefreshPolicies(run_loop.QuitClosure()); | |
361 run_loop.Run(); | |
362 } | |
363 EXPECT_TRUE(expected.Equals(policy_service->GetPolicies( | |
364 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); | |
365 | |
366 // Verify that the key was rotated. | |
367 std::string rotated_key; | |
368 ASSERT_TRUE( | |
369 file_util::ReadFileToString(user_policy_key_file(), &rotated_key)); | |
370 EXPECT_NE(rotated_key, initial_key); | |
371 | |
372 // Another refresh using the same key won't rotate it again. | |
373 { | |
374 base::RunLoop run_loop; | |
375 policy_service->RefreshPolicies(run_loop.QuitClosure()); | |
376 run_loop.Run(); | |
377 } | |
378 EXPECT_TRUE(expected.Equals(policy_service->GetPolicies( | |
379 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())))); | |
380 std::string current_key; | |
381 ASSERT_TRUE( | |
382 file_util::ReadFileToString(user_policy_key_file(), ¤t_key)); | |
383 EXPECT_EQ(rotated_key, current_key); | |
384 } | |
385 #endif | |
386 | |
387 TEST(CloudPolicyProtoTest, VerifyProtobufEquivalence) { | 240 TEST(CloudPolicyProtoTest, VerifyProtobufEquivalence) { |
388 // There are 2 protobufs that can be used for user cloud policy: | 241 // There are 2 protobufs that can be used for user cloud policy: |
389 // cloud_policy.proto and chrome_settings.proto. chrome_settings.proto is the | 242 // cloud_policy.proto and chrome_settings.proto. chrome_settings.proto is the |
390 // version used by the server, but generates one proto message per policy; to | 243 // version used by the server, but generates one proto message per policy; to |
391 // save binary size on the client, the other version shares proto messages for | 244 // save binary size on the client, the other version shares proto messages for |
392 // policies of the same type. They generate the same bytes on the wire though, | 245 // policies of the same type. They generate the same bytes on the wire though, |
393 // so they are compatible. This test verifies that that stays true. | 246 // so they are compatible. This test verifies that that stays true. |
394 | 247 |
395 // Build a ChromeSettingsProto message with one policy of each supported type. | 248 // Build a ChromeSettingsProto message with one policy of each supported type. |
396 em::ChromeSettingsProto chrome_settings; | 249 em::ChromeSettingsProto chrome_settings; |
(...skipping 30 matching lines...) Expand all Loading... |
427 | 280 |
428 // They should now serialize to the same bytes. | 281 // They should now serialize to the same bytes. |
429 std::string chrome_settings_serialized; | 282 std::string chrome_settings_serialized; |
430 std::string cloud_policy_serialized; | 283 std::string cloud_policy_serialized; |
431 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 284 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
432 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 285 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
433 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 286 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
434 } | 287 } |
435 | 288 |
436 } // namespace policy | 289 } // namespace policy |
OLD | NEW |