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

Side by Side Diff: components/ntp_snippets/offline_pages/offline_pages_test_utils.cc

Issue 2684973014: Only show Last N Pages in the UI when the corresponding tab is visible. (Closed)
Patch Set: Move impl out 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h" 5 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 bool FakeOfflinePageModel::is_loaded() const { 54 bool FakeOfflinePageModel::is_loaded() const {
55 return is_loaded_; 55 return is_loaded_;
56 } 56 }
57 57
58 void FakeOfflinePageModel::set_is_loaded(bool value) { 58 void FakeOfflinePageModel::set_is_loaded(bool value) {
59 is_loaded_ = value; 59 is_loaded_ = value;
60 } 60 }
61 61
62 OfflinePageItem CreateDummyOfflinePageItem(
63 int id,
64 const offline_pages::ClientId& client_id) {
65 std::string id_string = base::IntToString(id);
66 return OfflinePageItem(
67 GURL("http://dummy.com/" + id_string), id, client_id,
68 base::FilePath::FromUTF8Unsafe("some/folder/test" + id_string + ".mhtml"),
69 0, base::Time::Now());
70 }
71
62 OfflinePageItem CreateDummyOfflinePageItem(int id, 72 OfflinePageItem CreateDummyOfflinePageItem(int id,
63 const std::string& name_space) { 73 const std::string& name_space) {
64 std::string id_string = base::IntToString(id); 74 return CreateDummyOfflinePageItem(id,
65 return OfflinePageItem( 75 ClientId(name_space, base::GenerateGUID()));
66 GURL("http://dummy.com/" + id_string), id,
67 ClientId(name_space, base::GenerateGUID()),
68 base::FilePath::FromUTF8Unsafe("some/folder/test" + id_string + ".mhtml"),
69 0, base::Time::Now());
70 } 76 }
71 77
72 void CaptureDismissedSuggestions( 78 void CaptureDismissedSuggestions(
73 std::vector<ContentSuggestion>* captured_suggestions, 79 std::vector<ContentSuggestion>* captured_suggestions,
74 std::vector<ContentSuggestion> dismissed_suggestions) { 80 std::vector<ContentSuggestion> dismissed_suggestions) {
75 std::move(dismissed_suggestions.begin(), dismissed_suggestions.end(), 81 std::move(dismissed_suggestions.begin(), dismissed_suggestions.end(),
76 std::back_inserter(*captured_suggestions)); 82 std::back_inserter(*captured_suggestions));
77 } 83 }
78 84
79 } // namespace test 85 } // namespace test
80 } // namespace ntp_snippets 86 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698