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

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

Powered by Google App Engine
This is Rietveld 408576698