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_store_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 // Verify the legacy cache has been loaded. | 495 // Verify the legacy cache has been loaded. |
496 em::PolicyData expected_policy_data; | 496 em::PolicyData expected_policy_data; |
497 EXPECT_TRUE(expected_policy_data.ParseFromString( | 497 EXPECT_TRUE(expected_policy_data.ParseFromString( |
498 cached_policy.cloud_policy().policy_data())); | 498 cached_policy.cloud_policy().policy_data())); |
499 expected_policy_data.clear_public_key_version(); | 499 expected_policy_data.clear_public_key_version(); |
500 ASSERT_TRUE(store_->policy()); | 500 ASSERT_TRUE(store_->policy()); |
501 EXPECT_EQ(expected_policy_data.SerializeAsString(), | 501 EXPECT_EQ(expected_policy_data.SerializeAsString(), |
502 store_->policy()->SerializeAsString()); | 502 store_->policy()->SerializeAsString()); |
503 VerifyPolicyMap(kDefaultHomepage); | 503 VerifyPolicyMap(kDefaultHomepage); |
504 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); | 504 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); |
505 EXPECT_TRUE(file_util::PathExists(policy_file())); | 505 EXPECT_TRUE(base::PathExists(policy_file())); |
506 | 506 |
507 // Now store a new policy using the new homepage location. | 507 // Now store a new policy using the new homepage location. |
508 const char kNewHomepage[] = "http://google.com"; | 508 const char kNewHomepage[] = "http://google.com"; |
509 policy_.payload().mutable_homepagelocation()->set_value(kNewHomepage); | 509 policy_.payload().mutable_homepagelocation()->set_value(kNewHomepage); |
510 policy_.set_new_signing_key(PolicyBuilder::CreateTestNewSigningKey()); | 510 policy_.set_new_signing_key(PolicyBuilder::CreateTestNewSigningKey()); |
511 policy_.Build(); | 511 policy_.Build(); |
512 std::vector<uint8> new_public_key; | 512 std::vector<uint8> new_public_key; |
513 ASSERT_TRUE(policy_.new_signing_key()->ExportPublicKey(&new_public_key)); | 513 ASSERT_TRUE(policy_.new_signing_key()->ExportPublicKey(&new_public_key)); |
514 ASSERT_NO_FATAL_FAILURE( | 514 ASSERT_NO_FATAL_FAILURE( |
515 PerformStorePolicy(&new_public_key, kDefaultHomepage, kNewHomepage)); | 515 PerformStorePolicy(&new_public_key, kDefaultHomepage, kNewHomepage)); |
516 VerifyPolicyMap(kNewHomepage); | 516 VerifyPolicyMap(kNewHomepage); |
517 | 517 |
518 // Verify that the legacy cache has been removed. | 518 // Verify that the legacy cache has been removed. |
519 EXPECT_FALSE(file_util::PathExists(policy_file())); | 519 EXPECT_FALSE(base::PathExists(policy_file())); |
520 } | 520 } |
521 | 521 |
522 } // namespace | 522 } // namespace |
523 | 523 |
524 } // namespace policy | 524 } // namespace policy |
OLD | NEW |