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_updater.h" | 5 #include "components/policy/core/common/cloud/component_cloud_policy_updater.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 public: | 59 public: |
60 virtual ~MockComponentCloudPolicyStoreDelegate() {} | 60 virtual ~MockComponentCloudPolicyStoreDelegate() {} |
61 | 61 |
62 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); | 62 MOCK_METHOD0(OnComponentCloudPolicyStoreUpdated, void()); |
63 }; | 63 }; |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 class ComponentCloudPolicyUpdaterTest : public testing::Test { | 67 class ComponentCloudPolicyUpdaterTest : public testing::Test { |
68 protected: | 68 protected: |
69 virtual void SetUp() override; | 69 void SetUp() override; |
70 virtual void TearDown() override; | 70 void TearDown() override; |
71 | 71 |
72 scoped_ptr<em::PolicyFetchResponse> CreateResponse(); | 72 scoped_ptr<em::PolicyFetchResponse> CreateResponse(); |
73 | 73 |
74 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; | 74 scoped_refptr<base::TestSimpleTaskRunner> task_runner_; |
75 base::ScopedTempDir temp_dir_; | 75 base::ScopedTempDir temp_dir_; |
76 scoped_ptr<ResourceCache> cache_; | 76 scoped_ptr<ResourceCache> cache_; |
77 scoped_ptr<ComponentCloudPolicyStore> store_; | 77 scoped_ptr<ComponentCloudPolicyStore> store_; |
78 MockComponentCloudPolicyStoreDelegate store_delegate_; | 78 MockComponentCloudPolicyStoreDelegate store_delegate_; |
79 net::TestURLFetcherFactory fetcher_factory_; | 79 net::TestURLFetcherFactory fetcher_factory_; |
80 scoped_ptr<ExternalPolicyDataFetcherBackend> fetcher_backend_; | 80 scoped_ptr<ExternalPolicyDataFetcherBackend> fetcher_backend_; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 // Now cancel that update before the download completes. | 347 // Now cancel that update before the download completes. |
348 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); | 348 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); |
349 updater_->CancelUpdate( | 349 updater_->CancelUpdate( |
350 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); | 350 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); |
351 task_runner_->RunUntilIdle(); | 351 task_runner_->RunUntilIdle(); |
352 Mock::VerifyAndClearExpectations(&store_delegate_); | 352 Mock::VerifyAndClearExpectations(&store_delegate_); |
353 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); | 353 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
354 } | 354 } |
355 | 355 |
356 } // namespace policy | 356 } // namespace policy |
OLD | NEW |