OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_PREFETCH_DISPATCHER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_PREFETCH_DISPATCHER_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_PREFETCH_DISPATCHER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_PREFETCH_DISPATCHER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" | 12 #include "components/offline_pages/core/prefetch/prefetch_dispatcher.h" |
13 | 13 |
14 namespace offline_pages { | 14 namespace offline_pages { |
15 struct ClientId; | 15 struct ClientId; |
16 | 16 |
17 // Testing version of the prefetch dispatcher. | 17 // Testing version of the prefetch dispatcher. |
18 class TestPrefetchDispatcher : public PrefetchDispatcher { | 18 class TestPrefetchDispatcher : public PrefetchDispatcher { |
19 public: | 19 public: |
20 TestPrefetchDispatcher(); | 20 TestPrefetchDispatcher(); |
21 ~TestPrefetchDispatcher() override; | 21 ~TestPrefetchDispatcher() override; |
22 | 22 |
23 // PrefetchDispatcher implementation. | 23 // PrefetchDispatcher implementation. |
24 void AddCandidatePrefetchURLs( | 24 void AddCandidatePrefetchURLs( |
25 const std::vector<PrefetchURL>& suggested_urls) override; | 25 const std::string& name_space, |
| 26 const std::vector<PrefetchURL>& prefetch_urls) override; |
26 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; | 27 void RemoveAllUnprocessedPrefetchURLs(const std::string& name_space) override; |
27 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; | 28 void RemovePrefetchURLsByClientId(const ClientId& client_id) override; |
28 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; | 29 void BeginBackgroundTask(std::unique_ptr<ScopedBackgroundTask> task) override; |
29 void StopBackgroundTask() override; | 30 void StopBackgroundTask() override; |
30 void SetService(PrefetchService* service) override; | 31 void SetService(PrefetchService* service) override; |
31 void GCMOperationCompletedMessageReceived( | 32 void GCMOperationCompletedMessageReceived( |
32 const std::string& operation_name) override; | 33 const std::string& operation_name) override; |
33 void RequestFinishBackgroundTaskForTest() override; | 34 void RequestFinishBackgroundTaskForTest() override; |
34 | 35 |
| 36 std::string latest_name_space; |
35 std::vector<PrefetchURL> latest_prefetch_urls; | 37 std::vector<PrefetchURL> latest_prefetch_urls; |
36 std::unique_ptr<ClientId> last_removed_client_id; | 38 std::unique_ptr<ClientId> last_removed_client_id; |
37 std::vector<std::string> operation_list; | 39 std::vector<std::string> operation_list; |
38 | 40 |
39 int new_suggestions_count = 0; | 41 int new_suggestions_count = 0; |
40 int remove_all_suggestions_count = 0; | 42 int remove_all_suggestions_count = 0; |
41 int remove_by_client_id_count = 0; | 43 int remove_by_client_id_count = 0; |
42 }; | 44 }; |
43 | 45 |
44 } // namespace offline_pages | 46 } // namespace offline_pages |
45 | 47 |
46 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_PREFETCH_DISPATCHER_H_ | 48 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_TEST_PREFETCH_DISPATCHER_H_ |
OLD | NEW |