Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Side by Side Diff: content/public/test/cache_test_util.h

Issue 2827523003: Move BrowsingDataRemover to content/ (Closed)
Patch Set: Rebase over codereview.chromium.org/2815913005 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/test/browsing_data_remover_test_util.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_BROWSING_DATA_CACHE_TEST_UTIL_H_ 5 #ifndef CONTENT_BROWSER_BROWSING_DATA_CACHE_TEST_UTIL_H_
6 #define CHROME_BROWSER_BROWSING_DATA_CACHE_TEST_UTIL_H_ 6 #define CONTENT_BROWSER_BROWSING_DATA_CACHE_TEST_UTIL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/storage_partition.h" 12 #include "content/public/browser/storage_partition.h"
13 #include "net/disk_cache/disk_cache.h" 13 #include "net/disk_cache/disk_cache.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 // A util class that can be used to create and retreive cache entries. 17 // A util class that can be used to create and retreive cache entries.
18 class CacheTestUtil { 18 class CacheTestUtil {
19 public: 19 public:
20 explicit CacheTestUtil(content::StoragePartition* partition_); 20 explicit CacheTestUtil(StoragePartition* partition_);
21 21
22 ~CacheTestUtil(); 22 ~CacheTestUtil();
23 23
24 void CreateCacheEntries(const std::set<std::string>& keys); 24 void CreateCacheEntries(const std::set<std::string>& keys);
25 25
26 std::vector<std::string> GetEntryKeys(); 26 std::vector<std::string> GetEntryKeys();
27 27
28 content::StoragePartition* partition() { return partition_; } 28 StoragePartition* partition() { return partition_; }
29 disk_cache::Backend* backend() { return backend_; } 29 disk_cache::Backend* backend() { return backend_; }
30 30
31 private: 31 private:
32 void SetUpOnIOThread(); 32 void SetUpOnIOThread();
33 void TearDownOnIOThread(); 33 void TearDownOnIOThread();
34 34
35 void CreateCacheEntriesOnIOThread(const std::set<std::string>& keys); 35 void CreateCacheEntriesOnIOThread(const std::set<std::string>& keys);
36 36
37 void GetEntryKeysOnIOThread(); 37 void GetEntryKeysOnIOThread();
38 void GetNextKey(int error); 38 void GetNextKey(int error);
39 39
40 void WaitForTasksOnIOThread(); 40 void WaitForTasksOnIOThread();
41 void WaitForCompletion(int value); 41 void WaitForCompletion(int value);
42 void SetNumberOfWaitedTasks(int count); 42 void SetNumberOfWaitedTasks(int count);
43 43
44 void DoneCallback(int value); 44 void DoneCallback(int value);
45 45
46 base::Callback<void(int)> done_callback_; 46 base::Callback<void(int)> done_callback_;
47 47
48 content::StoragePartition* partition_; 48 StoragePartition* partition_;
49 disk_cache::Backend* backend_ = nullptr; 49 disk_cache::Backend* backend_ = nullptr;
50 std::vector<disk_cache::Entry*> entries_; 50 std::vector<disk_cache::Entry*> entries_;
51 std::unique_ptr<disk_cache::Backend::Iterator> iterator_; 51 std::unique_ptr<disk_cache::Backend::Iterator> iterator_;
52 52
53 disk_cache::Entry* current_entry_; 53 disk_cache::Entry* current_entry_;
54 std::vector<std::string> keys_; 54 std::vector<std::string> keys_;
55 55
56 std::unique_ptr<base::WaitableEvent> waitable_event_; 56 std::unique_ptr<base::WaitableEvent> waitable_event_;
57 int remaining_tasks_; 57 int remaining_tasks_;
58 }; 58 };
59 59
60 } // namespace content 60 } // content
61 61
62 #endif // CHROME_BROWSER_BROWSING_DATA_CACHE_TEST_UTIL_H_ 62 #endif // CONTENT_BROWSER_BROWSING_DATA_CACHE_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « content/public/test/browsing_data_remover_test_util.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698