| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "components/policy/core/common/cloud/component_cloud_policy_store.h" | 5 #include "components/policy/core/common/cloud/component_cloud_policy_store.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 public: | 61 public: |
| 62 virtual ~MockComponentCloudPolicyStoreDelegate() {} | 62 virtual ~MockComponentCloudPolicyStoreDelegate() {} |
| 63 | 63 |
| 64 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); | 64 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 class ComponentCloudPolicyStoreTest : public testing::Test { | 69 class ComponentCloudPolicyStoreTest : public testing::Test { |
| 70 protected: | 70 protected: |
| 71 virtual void SetUp() override { | 71 void SetUp() override { |
| 72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 72 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 73 cache_.reset(new ResourceCache( | 73 cache_.reset(new ResourceCache( |
| 74 temp_dir_.path(), | 74 temp_dir_.path(), |
| 75 make_scoped_refptr(new base::TestSimpleTaskRunner))); | 75 make_scoped_refptr(new base::TestSimpleTaskRunner))); |
| 76 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); | 76 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); |
| 77 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, | 77 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, |
| 78 ComponentPolicyBuilder::kFakeToken); | 78 ComponentPolicyBuilder::kFakeToken); |
| 79 | 79 |
| 80 builder_.policy_data().set_policy_type( | 80 builder_.policy_data().set_policy_type( |
| 81 dm_protocol::kChromeExtensionPolicyType); | 81 dm_protocol::kChromeExtensionPolicyType); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 // And they aren't loaded anymore either. | 323 // And they aren't loaded anymore either. |
| 324 ComponentCloudPolicyStore yet_another_store(&store_delegate_, cache_.get()); | 324 ComponentCloudPolicyStore yet_another_store(&store_delegate_, cache_.get()); |
| 325 yet_another_store.SetCredentials(ComponentPolicyBuilder::kFakeUsername, | 325 yet_another_store.SetCredentials(ComponentPolicyBuilder::kFakeUsername, |
| 326 ComponentPolicyBuilder::kFakeToken); | 326 ComponentPolicyBuilder::kFakeToken); |
| 327 yet_another_store.Load(); | 327 yet_another_store.Load(); |
| 328 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); | 328 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace policy | 331 } // namespace policy |
| OLD | NEW |