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

Side by Side Diff: components/ntp_snippets/remote/ntp_snippets_database_unittest.cc

Issue 2402323002: [NTP Snippets] Persist non-article remote suggestions in the DB (Closed)
Patch Set: review 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
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/remote/ntp_snippets_database.h" 5 #include "components/ntp_snippets/remote/ntp_snippets_database.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 27 matching lines...) Expand all
38 lhs.publish_date() == rhs.publish_date() && 38 lhs.publish_date() == rhs.publish_date() &&
39 lhs.expiry_date() == rhs.expiry_date() && 39 lhs.expiry_date() == rhs.expiry_date() &&
40 lhs.source_index() == rhs.source_index() && 40 lhs.source_index() == rhs.source_index() &&
41 lhs.sources() == rhs.sources() && lhs.score() == rhs.score() && 41 lhs.sources() == rhs.sources() && lhs.score() == rhs.score() &&
42 lhs.is_dismissed() == rhs.is_dismissed(); 42 lhs.is_dismissed() == rhs.is_dismissed();
43 } 43 }
44 44
45 namespace { 45 namespace {
46 46
47 std::unique_ptr<NTPSnippet> CreateTestSnippet() { 47 std::unique_ptr<NTPSnippet> CreateTestSnippet() {
48 std::unique_ptr<NTPSnippet> snippet(new NTPSnippet("http://localhost")); 48 std::unique_ptr<NTPSnippet> snippet(new NTPSnippet("http://localhost",
49 kArticlesRemoteId));
49 snippet->add_source( 50 snippet->add_source(
50 SnippetSource(GURL("http://localhost"), "Publisher", GURL("http://amp"))); 51 SnippetSource(GURL("http://localhost"), "Publisher", GURL("http://amp")));
51 return snippet; 52 return snippet;
52 } 53 }
53 54
54 MATCHER_P(SnippetEq, snippet, "") { 55 MATCHER_P(SnippetEq, snippet, "") {
55 return *arg == *snippet; 56 return *arg == *snippet;
56 } 57 }
57 58
58 } // namespace 59 } // namespace
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 base::RunLoop().RunUntilIdle(); 362 base::RunLoop().RunUntilIdle();
362 363
363 // Make sure the images are gone. 364 // Make sure the images are gone.
364 LoadExpectedImage(db(), "snippet-id-1", ""); 365 LoadExpectedImage(db(), "snippet-id-1", "");
365 LoadExpectedImage(db(), "snippet-id-3", ""); 366 LoadExpectedImage(db(), "snippet-id-3", "");
366 // Make sure the second still exists. 367 // Make sure the second still exists.
367 LoadExpectedImage(db(), "snippet-id-2", "pretty-image-2"); 368 LoadExpectedImage(db(), "snippet-id-2", "pretty-image-2");
368 } 369 }
369 370
370 } // namespace ntp_snippets 371 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/remote/ntp_snippet_unittest.cc ('k') | components/ntp_snippets/remote/ntp_snippets_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698