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

Side by Side Diff: components/offline_pages/fake_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: fix build.gn file name and lint Created 4 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 2016 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 COMPONENTS_OFFLINE_PAGES_FAKE_OFFLINE_PAGE_MODEL_H_
6 #define COMPONENTS_OFFLINE_PAGES_FAKE_OFFLINE_PAGE_MODEL_H_
7
8 #include <set>
9 #include <string>
10 #include <vector>
11
12 #include "components/offline_pages/offline_page_model.h"
13
14 namespace offline_pages {
15
16 // Fake implementation of OfflinePageModel interface for testing. Besides using
17 // as a fake for tests, it may also be subclassed to mock specific methods
18 // needed for a set of tests.
19 class FakeOfflinePageModel : public OfflinePageModel {
fgorski 2016/06/01 18:04:00 Did you consider naming it differently, e.g. TestO
Pete Williamson 2016/06/01 19:47:47 I agree that StubOfflinePageModel is good. I don'
dougarnett 2016/06/01 20:28:28 Done
20 public:
21 FakeOfflinePageModel() {}
22 ~FakeOfflinePageModel() override {}
23
24 void AddObserver(Observer* observer) override {}
25 void RemoveObserver(Observer* observer) override {}
26 void SavePage(const GURL& url,
27 const ClientId& client_id,
28 std::unique_ptr<OfflinePageArchiver> archiver,
29 const SavePageCallback& callback) override {}
30 void MarkPageAccessed(int64_t offline_id) override {}
31 void ClearAll(const base::Closure& callback) override {}
32 void DeletePagesByOfflineId(const std::vector<int64_t>& offline_ids,
33 const DeletePageCallback& callback) override {}
34 void DeletePagesByURLPredicate(const UrlPredicate& predicate,
35 const DeletePageCallback& callback) override {}
36 void HasPages(const std::string& name_space,
37 const HasPagesCallback& callback) override {}
38 void CheckPagesExistOffline(
39 const std::set<GURL>& urls,
40 const CheckPagesExistOfflineCallback& callback) override {}
41 void GetAllPages(const MultipleOfflinePageItemCallback& callback) override {}
42 void GetOfflineIdsForClientId(
43 const ClientId& client_id,
44 const MultipleOfflineIdCallback& callback) override {}
45 const std::vector<int64_t> MaybeGetOfflineIdsForClientId(
46 const ClientId& client_id) const override {
47 return offline_ids_;
48 }
49 void GetPageByOfflineId(
50 int64_t offline_id,
51 const SingleOfflinePageItemCallback& callback) override {}
52 const OfflinePageItem* MaybeGetPageByOfflineId(
53 int64_t offline_id) const override {
54 return nullptr;
55 }
56 void GetPageByOfflineURL(
57 const GURL& offline_url,
58 const SingleOfflinePageItemCallback& callback) override {}
59 const OfflinePageItem* MaybeGetPageByOfflineURL(
60 const GURL& offline_url) const override {
61 return nullptr;
62 }
63 void GetPagesByOnlineURL(
64 const GURL& online_url,
65 const MultipleOfflinePageItemCallback& callback) override {}
66 void GetBestPageForOnlineURL(
67 const GURL& online_url,
68 const SingleOfflinePageItemCallback callback) override {}
69 const OfflinePageItem* MaybeGetBestPageForOnlineURL(
70 const GURL& online_url) const override {
71 return nullptr;
72 }
73 void CheckForExternalFileDeletion() override {}
74 void ExpirePages(const std::vector<int64_t>& offline_ids,
75 const base::Time& expiration_time,
76 const base::Callback<void(bool)>& callback) override {}
77 ClientPolicyController* GetPolicyController() override { return nullptr; }
78 bool is_loaded() const override { return true; }
79
80 private:
81 std::vector<int64_t> offline_ids_;
82 };
83
84 } // namespace offline_pages
85
86 #endif // COMPONENTS_OFFLINE_PAGES_FAKE_OFFLINE_PAGE_MODEL_H_
OLDNEW
« components/offline_pages/BUILD.gn ('K') | « components/offline_pages/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698