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

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

Issue 2368923003: Support the Clear-Site-Data header on resource requests (Closed)
Patch Set: Addressed comments, formatted. Created 3 years, 6 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
OLDNEW
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 CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_REMOVER_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_REMOVER_DELEGATE_H_
6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_REMOVER_DELEGATE_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_REMOVER_DELEGATE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/public/browser/browsing_data_filter_builder.h" 12 #include "content/public/browser/browsing_data_filter_builder.h"
13 #include "content/public/browser/browsing_data_remover_delegate.h" 13 #include "content/public/browser/browsing_data_remover_delegate.h"
14 14
15 namespace content {
16
15 // A BrowsingDataRemoverDelegate that only records RemoveEmbedderData() calls. 17 // A BrowsingDataRemoverDelegate that only records RemoveEmbedderData() calls.
16 class MockBrowsingDataRemoverDelegate 18 class MockBrowsingDataRemoverDelegate : public BrowsingDataRemoverDelegate {
17 : public content::BrowsingDataRemoverDelegate {
18 public: 19 public:
19 MockBrowsingDataRemoverDelegate(); 20 MockBrowsingDataRemoverDelegate();
20 ~MockBrowsingDataRemoverDelegate() override; 21 ~MockBrowsingDataRemoverDelegate() override;
21 22
22 // BrowsingDataRemoverDelegate: 23 // BrowsingDataRemoverDelegate:
23 content::BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher 24 BrowsingDataRemoverDelegate::EmbedderOriginTypeMatcher GetOriginTypeMatcher()
24 GetOriginTypeMatcher() const override; 25 const override;
25 bool MayRemoveDownloadHistory() const override; 26 bool MayRemoveDownloadHistory() const override;
26 void RemoveEmbedderData( 27 void RemoveEmbedderData(const base::Time& delete_begin,
27 const base::Time& delete_begin, 28 const base::Time& delete_end,
28 const base::Time& delete_end, 29 int remove_mask,
29 int remove_mask, 30 const BrowsingDataFilterBuilder& filter_builder,
30 const content::BrowsingDataFilterBuilder& filter_builder, 31 int origin_type_mask,
31 int origin_type_mask, 32 const base::Closure& callback) override;
32 const base::Closure& callback) override;
33 33
34 // Add an expected call for testing. 34 // Add an expected call for testing.
35 void ExpectCall(const base::Time& delete_begin, 35 void ExpectCall(const base::Time& delete_begin,
36 const base::Time& delete_end, 36 const base::Time& delete_end,
37 int remove_mask, 37 int remove_mask,
38 int origin_type_mask, 38 int origin_type_mask,
39 const content::BrowsingDataFilterBuilder& filter_builder); 39 const BrowsingDataFilterBuilder& filter_builder);
40 40
41 // Add an expected call that doesn't have to match the filter_builder. 41 // Add an expected call that doesn't have to match the filter_builder.
42 void ExpectCallDontCareAboutFilterBuilder(const base::Time& delete_begin, 42 void ExpectCallDontCareAboutFilterBuilder(const base::Time& delete_begin,
43 const base::Time& delete_end, 43 const base::Time& delete_end,
44 int remove_mask, 44 int remove_mask,
45 int origin_type_mask); 45 int origin_type_mask);
46 46
47 // Verify that expected and actual calls match. 47 // Verify that expected and actual calls match.
48 void VerifyAndClearExpectations(); 48 void VerifyAndClearExpectations();
49 49
50 private: 50 private:
51 class CallParameters { 51 class CallParameters {
52 public: 52 public:
53 CallParameters( 53 CallParameters(const base::Time& delete_begin,
54 const base::Time& delete_begin, 54 const base::Time& delete_end,
55 const base::Time& delete_end, 55 int remove_mask,
56 int remove_mask, 56 int origin_type_mask,
57 int origin_type_mask, 57 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder,
58 std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder, 58 bool should_compare_filter);
59 bool should_compare_filter);
60 ~CallParameters(); 59 ~CallParameters();
61 60
62 bool operator==(const CallParameters& other) const; 61 bool operator==(const CallParameters& other) const;
63 62
64 private: 63 private:
65 base::Time delete_begin_; 64 base::Time delete_begin_;
66 base::Time delete_end_; 65 base::Time delete_end_;
67 int remove_mask_; 66 int remove_mask_;
68 int origin_type_mask_; 67 int origin_type_mask_;
69 std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder_; 68 std::unique_ptr<BrowsingDataFilterBuilder> filter_builder_;
70 bool should_compare_filter_; 69 bool should_compare_filter_;
71 }; 70 };
72 71
73 std::list<CallParameters> actual_calls_; 72 std::list<CallParameters> actual_calls_;
74 std::list<CallParameters> expected_calls_; 73 std::list<CallParameters> expected_calls_;
75 }; 74 };
76 75
76 } // content
77
77 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_REMOVER_DELEGATE_H_ 78 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_REMOVER_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/public/browser/content_browser_client.h ('k') | content/public/test/mock_browsing_data_remover_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698