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

Unified Diff: components/ntp_snippets/ntp_snippets_fetcher_unittest.cc

Issue 2271283002: Add request type to FetchSuggestionsRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
diff --git a/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc b/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
index c4249008a16de07882ccc0136732b40ce772ea58..8605b0efd6b8233de1756ced65b9f2417efb0c76 100644
--- a/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
+++ b/components/ntp_snippets/ntp_snippets_fetcher_unittest.cc
@@ -147,9 +147,8 @@ GURL GetFetcherUrl(const char* url_format) {
class NTPSnippetsFetcherTest : public testing::Test {
public:
NTPSnippetsFetcherTest()
- : NTPSnippetsFetcherTest(
- GetFetcherUrl(kTestChromeReaderUrlFormat),
- std::map<std::string, std::string>()) {}
+ : NTPSnippetsFetcherTest(GetFetcherUrl(kTestChromeReaderUrlFormat),
+ std::map<std::string, std::string>()) {}
NTPSnippetsFetcherTest(const GURL& gurl,
const std::map<std::string, std::string>& params)
@@ -247,9 +246,8 @@ class NTPSnippetsContentSuggestionsFetcherTest : public NTPSnippetsFetcherTest {
class NTPSnippetsFetcherHostRestrictedTest : public NTPSnippetsFetcherTest {
public:
NTPSnippetsFetcherHostRestrictedTest()
- : NTPSnippetsFetcherTest(
- GetFetcherUrl(kTestChromeReaderUrlFormat),
- {{"fetching_host_restrict", "on"}}) {}
+ : NTPSnippetsFetcherTest(GetFetcherUrl(kTestChromeReaderUrlFormat),
+ {{"fetching_host_restrict", "on"}}) {}
};
TEST_F(NTPSnippetsFetcherTest, BuildRequestAuthenticated) {
@@ -260,6 +258,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestAuthenticated) {
params.host_restricts = {"chromium.org"};
params.excluded_ids = {"1234567890"};
params.count_to_fetch = 25;
+ params.interactive_request = false;
params.fetch_api = NTPSnippetsFetcher::CHROME_READER_API;
EXPECT_THAT(params.BuildRequest(),
@@ -304,6 +303,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestAuthenticated) {
EXPECT_THAT(params.BuildRequest(),
EqualsJSON("{"
" \"uiLanguage\": \"en\","
+ " \"priority\": \"BACKGROUND_PREFETCH\","
" \"regularlyVisitedHostNames\": ["
" \"chromium.org\""
" ],"
@@ -319,6 +319,8 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestUnauthenticated) {
params.host_restricts = {};
params.count_to_fetch = 10;
params.excluded_ids = {};
+ params.interactive_request = true;
+
params.fetch_api = NTPSnippetsFetcher::CHROME_READER_API;
EXPECT_THAT(params.BuildRequest(),
@@ -356,6 +358,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestUnauthenticated) {
EXPECT_THAT(params.BuildRequest(),
EqualsJSON("{"
" \"regularlyVisitedHostNames\": [],"
+ " \"priority\": \"USER_ACTION\","
" \"excludedSuggestionIds\": []"
"}"));
}
@@ -365,6 +368,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestExcludedIds) {
params.only_return_personalized_results = false;
params.host_restricts = {};
params.count_to_fetch = 10;
+ params.interactive_request = false;
for (int i = 0; i < 200; ++i) {
params.excluded_ids.insert(base::StringPrintf("%03d", i));
}
@@ -373,6 +377,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestExcludedIds) {
EXPECT_THAT(params.BuildRequest(),
EqualsJSON("{"
" \"regularlyVisitedHostNames\": [],"
+ " \"priority\": \"BACKGROUND_PREFETCH\","
" \"excludedSuggestionIds\": ["
" \"000\", \"001\", \"002\", \"003\", \"004\","
" \"005\", \"006\", \"007\", \"008\", \"009\","
« no previous file with comments | « components/ntp_snippets/ntp_snippets_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698