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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 GetForProfile(browser()->profile()))->GetInvalidationService()); | 307 GetForProfile(browser()->profile()))->GetInvalidationService()); |
308 } | 308 } |
309 | 309 |
310 void SetServerPolicy(const std::string& policy) { | 310 void SetServerPolicy(const std::string& policy) { |
311 int result = base::WriteFile(policy_file_path(), policy.data(), | 311 int result = base::WriteFile(policy_file_path(), policy.data(), |
312 policy.size()); | 312 policy.size()); |
313 ASSERT_EQ(static_cast<int>(policy.size()), result); | 313 ASSERT_EQ(static_cast<int>(policy.size()), result); |
314 } | 314 } |
315 | 315 |
316 base::FilePath policy_file_path() const { | 316 base::FilePath policy_file_path() const { |
317 return temp_dir_.path().AppendASCII("policy.json"); | 317 return temp_dir_.GetPath().AppendASCII("policy.json"); |
318 } | 318 } |
319 | 319 |
320 void OnPolicyUpdated(const PolicyNamespace& ns, | 320 void OnPolicyUpdated(const PolicyNamespace& ns, |
321 const PolicyMap& previous, | 321 const PolicyMap& previous, |
322 const PolicyMap& current) override { | 322 const PolicyMap& current) override { |
323 if (!on_policy_updated_.is_null()) { | 323 if (!on_policy_updated_.is_null()) { |
324 on_policy_updated_.Run(); | 324 on_policy_updated_.Run(); |
325 on_policy_updated_.Reset(); | 325 on_policy_updated_.Reset(); |
326 } | 326 } |
327 } | 327 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 494 |
495 // They should now serialize to the same bytes. | 495 // They should now serialize to the same bytes. |
496 std::string chrome_settings_serialized; | 496 std::string chrome_settings_serialized; |
497 std::string cloud_policy_serialized; | 497 std::string cloud_policy_serialized; |
498 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 498 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
499 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 499 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
500 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 500 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
501 } | 501 } |
502 | 502 |
503 } // namespace policy | 503 } // namespace policy |
OLD | NEW |