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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover_mock.h

Issue 2720723002: Extract MockBrowsingDataRemover to separate file to make it possible to use it (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/browsing_data/browsing_data_remover_mock.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browsing_data/browsing_data_remover_mock.h
diff --git a/chrome/browser/browsing_data/browsing_data_remover_mock.h b/chrome/browser/browsing_data/browsing_data_remover_mock.h
new file mode 100644
index 0000000000000000000000000000000000000000..21c048a170cfa72c87f3aa1db3fa9a607b93f9b0
--- /dev/null
+++ b/chrome/browser/browsing_data/browsing_data_remover_mock.h
@@ -0,0 +1,71 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_MOCK_H_
msramek 2017/02/27 14:22:41 The file should be called the same way as the clas
dullweber 2017/02/27 16:04:11 Done.
+#define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_MOCK_H_
+
+#include "chrome/browser/browsing_data/browsing_data_remover_impl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+// A BrowsingDataRemover that only records calls.
+// TODO(msramek): Once BrowsingDataRemoverImpl moves to content/ (non-public),
+// it will not be possible to inherit from it here. However, at that time
+// this functionality will become redundant, as it will no longer be necessary
+// to call to chrome/ to perform deletion. Remove it then.
+class MockBrowsingDataRemover : public BrowsingDataRemoverImpl {
msramek 2017/02/27 14:22:41 We should inherit from BrowsingDataRemover (the pu
dullweber 2017/02/27 16:04:11 I changed this class to inherit from the interface
+ public:
+ explicit MockBrowsingDataRemover(content::BrowserContext* context);
+
+ ~MockBrowsingDataRemover() override;
+
+ void RemoveInternal(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ int remove_mask,
+ int origin_type_mask,
+ std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder,
+ BrowsingDataRemover::Observer* observer) override;
+
+ void ExpectCall(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ int remove_mask,
+ int origin_type_mask,
+ std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder);
+
+ void ExpectCallDontCareAboutFilterBuilder(const base::Time& delete_begin,
+ const base::Time& delete_end,
+ int remove_mask,
+ int origin_type_mask);
+
+ void VerifyAndClearExpectations();
+
+ private:
+ class CallParameters {
+ public:
+ CallParameters(
+ const base::Time& delete_begin,
+ const base::Time& delete_end,
+ int remove_mask,
+ int origin_type_mask,
+ std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder,
+ bool should_compare_filter);
+ ~CallParameters();
+
+ bool operator==(const CallParameters& other) const;
+
+ private:
+ base::Time delete_begin_;
+ base::Time delete_end_;
+ int remove_mask_;
+ int origin_type_mask_;
+ std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder_;
+ bool should_compare_filter_;
+ };
+
+ std::list<CallParameters> actual_calls_;
+ std::list<CallParameters> expected_calls_;
+};
+
+#endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_REMOVER_MOCK_H_
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/browsing_data/browsing_data_remover_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698