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/bind.h" | 10 #include "base/bind.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); | 65 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace | 68 } // namespace |
69 | 69 |
70 class ComponentCloudPolicyStoreTest : public testing::Test { | 70 class ComponentCloudPolicyStoreTest : public testing::Test { |
71 protected: | 71 protected: |
72 void SetUp() override { | 72 void SetUp() override { |
73 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 73 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
74 cache_.reset(new ResourceCache( | 74 cache_.reset( |
75 temp_dir_.path(), | 75 new ResourceCache(temp_dir_.GetPath(), |
76 make_scoped_refptr(new base::TestSimpleTaskRunner))); | 76 make_scoped_refptr(new base::TestSimpleTaskRunner))); |
77 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); | 77 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); |
78 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, | 78 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, |
79 ComponentPolicyBuilder::kFakeToken); | 79 ComponentPolicyBuilder::kFakeToken); |
80 | 80 |
81 builder_.policy_data().set_policy_type( | 81 builder_.policy_data().set_policy_type( |
82 dm_protocol::kChromeExtensionPolicyType); | 82 dm_protocol::kChromeExtensionPolicyType); |
83 builder_.policy_data().set_settings_entity_id(kTestExtension); | 83 builder_.policy_data().set_settings_entity_id(kTestExtension); |
84 builder_.payload().set_download_url(kTestDownload); | 84 builder_.payload().set_download_url(kTestDownload); |
85 builder_.payload().set_secure_hash(TestPolicyHash()); | 85 builder_.payload().set_secure_hash(TestPolicyHash()); |
86 | 86 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 // And they aren't loaded anymore either. | 320 // And they aren't loaded anymore either. |
321 ComponentCloudPolicyStore yet_another_store(&store_delegate_, cache_.get()); | 321 ComponentCloudPolicyStore yet_another_store(&store_delegate_, cache_.get()); |
322 yet_another_store.SetCredentials(ComponentPolicyBuilder::kFakeUsername, | 322 yet_another_store.SetCredentials(ComponentPolicyBuilder::kFakeUsername, |
323 ComponentPolicyBuilder::kFakeToken); | 323 ComponentPolicyBuilder::kFakeToken); |
324 yet_another_store.Load(); | 324 yet_another_store.Load(); |
325 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); | 325 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); |
326 } | 326 } |
327 | 327 |
328 } // namespace policy | 328 } // namespace policy |
OLD | NEW |