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/external_policy_data_updater.h" | 5 #include "components/policy/core/common/cloud/external_policy_data_updater.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 MockFetchSuccessCallbackListener::CreateCallback(const std::string& key) { | 52 MockFetchSuccessCallbackListener::CreateCallback(const std::string& key) { |
53 return base::Bind(&MockFetchSuccessCallbackListener::OnFetchSuccess, | 53 return base::Bind(&MockFetchSuccessCallbackListener::OnFetchSuccess, |
54 base::Unretained(this), | 54 base::Unretained(this), |
55 key); | 55 key); |
56 } | 56 } |
57 | 57 |
58 } // namespace | 58 } // namespace |
59 | 59 |
60 class ExternalPolicyDataUpdaterTest : public testing::Test { | 60 class ExternalPolicyDataUpdaterTest : public testing::Test { |
61 protected: | 61 protected: |
62 virtual void SetUp() override; | 62 void SetUp() override; |
63 | 63 |
64 void CreateUpdater(size_t max_parallel_fetches); | 64 void CreateUpdater(size_t max_parallel_fetches); |
65 ExternalPolicyDataUpdater::Request CreateRequest( | 65 ExternalPolicyDataUpdater::Request CreateRequest( |
66 const std::string& url) const; | 66 const std::string& url) const; |
67 void RequestExternalDataFetch(int key_index, int url_index); | 67 void RequestExternalDataFetch(int key_index, int url_index); |
68 void RequestExternalDataFetch(int index); | 68 void RequestExternalDataFetch(int index); |
69 | 69 |
70 net::TestURLFetcherFactory fetcher_factory_; | 70 net::TestURLFetcherFactory fetcher_factory_; |
71 MockFetchSuccessCallbackListener callback_listener_; | 71 MockFetchSuccessCallbackListener callback_listener_; |
72 scoped_refptr<base::TestSimpleTaskRunner> backend_task_runner_; | 72 scoped_refptr<base::TestSimpleTaskRunner> backend_task_runner_; |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 // Verify that the second fetch is no longer running. | 953 // Verify that the second fetch is no longer running. |
954 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(1)); | 954 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(1)); |
955 | 955 |
956 // Verify that the third fetch has been started. | 956 // Verify that the third fetch has been started. |
957 fetcher = fetcher_factory_.GetFetcherByID(2); | 957 fetcher = fetcher_factory_.GetFetcherByID(2); |
958 ASSERT_TRUE(fetcher); | 958 ASSERT_TRUE(fetcher); |
959 EXPECT_EQ(GURL(kExternalPolicyDataURLs[2]), fetcher->GetOriginalURL()); | 959 EXPECT_EQ(GURL(kExternalPolicyDataURLs[2]), fetcher->GetOriginalURL()); |
960 } | 960 } |
961 | 961 |
962 } // namespace policy | 962 } // namespace policy |
OLD | NEW |