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

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

Powered by Google App Engine
This is Rietveld 408576698