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: Addressed comments. 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
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 de2e1ccd3bf94f7e2f2fecab6c5213ee85228574..1502b7d24f03c74e39f5e7edd1ac99cd8fa13e37 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)
@@ -244,9 +243,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) {
@@ -256,6 +254,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestAuthenticated) {
params.user_locale = "en";
params.host_restricts = {"chromium.org"};
params.count_to_fetch = 25;
+ params.interactive_request = false;
params.fetch_api = NTPSnippetsFetcher::CHROME_READER_API;
EXPECT_THAT(params.BuildRequest(),
@@ -300,6 +299,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestAuthenticated) {
EXPECT_THAT(params.BuildRequest(),
EqualsJSON("{"
" \"uiLanguage\": \"en\","
+ " \"type\": \"BACKGROUND\","
" \"regularlyVisitedHostNames\": ["
" \"chromium.org\""
" ]"
@@ -311,6 +311,7 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestUnauthenticated) {
params.only_return_personalized_results = false;
params.host_restricts = {};
params.count_to_fetch = 10;
+ params.interactive_request = true;
params.fetch_api = NTPSnippetsFetcher::CHROME_READER_API;
EXPECT_THAT(params.BuildRequest(),
@@ -347,7 +348,8 @@ TEST_F(NTPSnippetsFetcherTest, BuildRequestUnauthenticated) {
params.fetch_api = NTPSnippetsFetcher::CHROME_CONTENT_SUGGESTIONS_API;
EXPECT_THAT(params.BuildRequest(),
EqualsJSON("{"
- " \"regularlyVisitedHostNames\": []"
+ " \"regularlyVisitedHostNames\": [],"
+ " \"type\": \"INTERACTIVE\""
"}"));
}

Powered by Google App Engine
This is Rietveld 408576698