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

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

Issue 2360263002: [NTPSnippets] Show all downloads on the NTP (3/3): Downloads provider. (Closed)
Patch Set: the freshest rebase. Created 4 years, 1 month 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 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h"
6
7 #include <iterator>
8 #include <vector>
9
10 #include "base/guid.h"
11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h"
13
14 using offline_pages::ClientId;
15 using offline_pages::MultipleOfflinePageItemCallback;
16 using offline_pages::OfflinePageItem;
17 using offline_pages::StubOfflinePageModel;
18
19 namespace ntp_snippets {
20 namespace test {
21
22 FakeOfflinePageModel::FakeOfflinePageModel() {}
23
24 FakeOfflinePageModel::~FakeOfflinePageModel() {}
25
26 void FakeOfflinePageModel::GetAllPages(
27 const MultipleOfflinePageItemCallback& callback) {
28 callback.Run(items_);
29 }
30
31 const std::vector<OfflinePageItem>& FakeOfflinePageModel::items() {
32 return items_;
33 }
34
35 std::vector<OfflinePageItem>* FakeOfflinePageModel::mutable_items() {
36 return &items_;
37 }
38
39 OfflinePageItem CreateDummyOfflinePageItem(int id,
40 const std::string& name_space) {
41 std::string id_string = base::IntToString(id);
42 return OfflinePageItem(
43 GURL("http://dummy.com/" + id_string), id,
44 ClientId(name_space, base::GenerateGUID()),
45 base::FilePath::FromUTF8Unsafe("some/folder/test" + id_string + ".mhtml"),
46 0, base::Time::Now());
47 }
48
49 void CaptureDismissedSuggestions(
50 std::vector<ContentSuggestion>* captured_suggestions,
51 std::vector<ContentSuggestion> dismissed_suggestions) {
52 std::move(dismissed_suggestions.begin(), dismissed_suggestions.end(),
53 std::back_inserter(*captured_suggestions));
54 }
55
56 } // namespace test
57 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698