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

Unified Diff: components/offline_pages/stub_offline_page_model.h

Issue 2016313003: Adds unit tests for Offliner SavePage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed Fake* to Stub* and added files to proper build target Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/stub_offline_page_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/stub_offline_page_model.h
diff --git a/components/offline_pages/stub_offline_page_model.h b/components/offline_pages/stub_offline_page_model.h
new file mode 100644
index 0000000000000000000000000000000000000000..45102e130c4cf7d7d1f5c534736185ec6d79a7bc
--- /dev/null
+++ b/components/offline_pages/stub_offline_page_model.h
@@ -0,0 +1,78 @@
+// Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_STUB_OFFLINE_PAGE_MODEL_H_
+#define COMPONENTS_OFFLINE_PAGES_STUB_OFFLINE_PAGE_MODEL_H_
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "components/offline_pages/offline_page_model.h"
+
+namespace offline_pages {
+
+// Stub implementation of OfflinePageModel interface for testing. Besides using
+// as a stub for tests, it may also be subclassed to mock specific methods
+// needed for a set of tests.
+class StubOfflinePageModel : public OfflinePageModel {
+ public:
+ StubOfflinePageModel();
+ ~StubOfflinePageModel() override;
+
+ void AddObserver(Observer* observer) override;
+ void RemoveObserver(Observer* observer) override;
+ void SavePage(const GURL& url,
+ const ClientId& client_id,
+ std::unique_ptr<OfflinePageArchiver> archiver,
+ const SavePageCallback& callback) override;
+ void MarkPageAccessed(int64_t offline_id) override;
+ void ClearAll(const base::Closure& callback) override;
+ void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
+ const DeletePageCallback& callback) override;
+ void DeletePagesByURLPredicate(const UrlPredicate& predicate,
+ const DeletePageCallback& callback) override;
+ void HasPages(const std::string& name_space,
+ const HasPagesCallback& callback) override;
+ void CheckPagesExistOffline(
+ const std::set<GURL>& urls,
+ const CheckPagesExistOfflineCallback& callback) override;
+ void GetAllPages(const MultipleOfflinePageItemCallback& callback) override;
+ void GetOfflineIdsForClientId(
+ const ClientId& client_id,
+ const MultipleOfflineIdCallback& callback) override;
+ const std::vector<int64_t> MaybeGetOfflineIdsForClientId(
+ const ClientId& client_id) const override;
+ void GetPageByOfflineId(
+ int64_t offline_id,
+ const SingleOfflinePageItemCallback& callback) override;
+ const OfflinePageItem* MaybeGetPageByOfflineId(
+ int64_t offline_id) const override;
+ void GetPageByOfflineURL(
+ const GURL& offline_url,
+ const SingleOfflinePageItemCallback& callback) override;
+ const OfflinePageItem* MaybeGetPageByOfflineURL(
+ const GURL& offline_url) const override;
+ void GetPagesByOnlineURL(
+ const GURL& online_url,
+ const MultipleOfflinePageItemCallback& callback) override;
+ void GetBestPageForOnlineURL(
+ const GURL& online_url,
+ const SingleOfflinePageItemCallback callback) override;
+ const OfflinePageItem* MaybeGetBestPageForOnlineURL(
+ const GURL& online_url) const override;
+ void CheckForExternalFileDeletion() override;
+ void ExpirePages(const std::vector<int64_t>& offline_ids,
+ const base::Time& expiration_time,
+ const base::Callback<void(bool)>& callback) override;
+ ClientPolicyController* GetPolicyController() override;
+ bool is_loaded() const override;
+
+ private:
+ std::vector<int64_t> offline_ids_;
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_STUB_OFFLINE_PAGE_MODEL_H_
« no previous file with comments | « components/offline_pages/BUILD.gn ('k') | components/offline_pages/stub_offline_page_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698