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

Side by Side Diff: components/offline_pages/offline_page_model_unittest.cc

Issue 1160283003: [Offline] Creates metadata store interface for offline pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline-pages-1
Patch Set: Removing Destroy, simplifying callbacks Created 5 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 2015 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 #include "components/offline_pages/offline_page_model.h"
6
7 #include "components/offline_pages/offline_page_metadata_store.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h"
10
11 namespace offline_pages {
12
13 namespace {
14
15 class OfflinePageTestStore : public OfflinePageMetadataStore {
16 public:
17 ~OfflinePageTestStore() override;
18
19 // OfflinePageMetadataStore overrides:
20 void Load(const LoadCallback& callback) override;
21 void AddOfflinePage(const OfflinePageItem& offline_page,
22 const UpdateCallback& callback) override;
23 void RemoveOfflinePage(const GURL& page_url,
24 const UpdateCallback& callback) override;
25 };
26
27 OfflinePageTestStore::~OfflinePageTestStore() {
28 }
29
30 void OfflinePageTestStore::Load(const LoadCallback& callback) {
31 }
32
33 void OfflinePageTestStore::AddOfflinePage(const OfflinePageItem& offline_page,
34 const UpdateCallback& callback) {
35 }
36
37 void OfflinePageTestStore::RemoveOfflinePage(const GURL& page_url,
38 const UpdateCallback& callback) {
39 }
40
41 class OfflinePageModelTest : public testing::Test {
42 public:
43 OfflinePageModelTest();
44 ~OfflinePageModelTest() override;
45
46 scoped_ptr<OfflinePageMetadataStore> BuildStore();
47 };
48
49 OfflinePageModelTest::OfflinePageModelTest() {
50 }
51
52 OfflinePageModelTest::~OfflinePageModelTest() {
53 }
54
55 scoped_ptr<OfflinePageMetadataStore> OfflinePageModelTest::BuildStore() {
56 return scoped_ptr<OfflinePageMetadataStore>(new OfflinePageTestStore());
57 }
58
59 TEST_F(OfflinePageModelTest, Initialize) {
60 OfflinePageModel model;
61 EXPECT_EQ(nullptr, model.GetStoreForTesting());
62 scoped_ptr<OfflinePageMetadataStore> store = BuildStore();
63 OfflinePageMetadataStore* store_ptr = store.get();
64 model.Initialize(store.Pass());
65 EXPECT_EQ(store_ptr, model.GetStoreForTesting());
66 }
67
68 } // namespace
69
70 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698