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

Unified Diff: components/ntp_snippets/remote/json_request_unittest.cc

Issue 2771813002: RemoteSuggestionsFetcher: Remove ChromeReader integration (Closed)
Patch Set: Created 3 years, 9 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/remote/json_request_unittest.cc
diff --git a/components/ntp_snippets/remote/json_request_unittest.cc b/components/ntp_snippets/remote/json_request_unittest.cc
index 912042f6e16ed7dc9655039903416417e88b4058..9284219e31484e277feddb7310f44d02070800ed 100644
--- a/components/ntp_snippets/remote/json_request_unittest.cc
+++ b/components/ntp_snippets/remote/json_request_unittest.cc
@@ -112,10 +112,8 @@ TEST_F(JsonRequestTest, BuildRequestAuthenticated) {
params.interactive_request = false;
builder.SetParams(params)
.SetUrl(GURL("http://valid-url.test"))
- .SetUrl(GURL("http://valid-url.test"))
.SetAuthentication("0BFUSGAIA", "headerstuff")
.SetUserClassForTesting("ACTIVE_NTP_USER")
- .SetFetchAPI(FetchAPI::CHROME_READER_API)
.Build();
EXPECT_THAT(builder.PreviewRequestHeadersForTesting(),
@@ -124,36 +122,6 @@ TEST_F(JsonRequestTest, BuildRequestAuthenticated) {
"\r\n"));
EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
EqualsJSON("{"
- " \"response_detail_level\": \"STANDARD\","
- " \"obfuscated_gaia_id\": \"0BFUSGAIA\","
- " \"advanced_options\": {"
- " \"local_scoring_params\": {"
- " \"content_restricts\": ["
- " {"
- " \"type\": \"METADATA\","
- " \"value\": \"TITLE\""
- " },"
- " {"
- " \"type\": \"METADATA\","
- " \"value\": \"SNIPPET\""
- " },"
- " {"
- " \"type\": \"METADATA\","
- " \"value\": \"THUMBNAIL\""
- " }"
- " ]"
- " },"
- " \"global_scoring_params\": {"
- " \"num_to_return\": 25,"
- " \"sort_type\": 1"
- " }"
- " }"
- "}"));
-
- builder.SetFetchAPI(FetchAPI::CHROME_CONTENT_SUGGESTIONS_API);
-
- EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
- EqualsJSON("{"
" \"priority\": \"BACKGROUND_PREFETCH\","
" \"excludedSuggestionIds\": ["
" \"1234567890\""
@@ -167,43 +135,13 @@ TEST_F(JsonRequestTest, BuildRequestUnauthenticated) {
RequestParams params;
params.interactive_request = true;
params.count_to_fetch = 10;
- builder.SetParams(params)
- .SetUserClassForTesting("ACTIVE_NTP_USER")
- .SetFetchAPI(FetchAPI::CHROME_READER_API);
+ builder.SetParams(params).SetUserClassForTesting("ACTIVE_NTP_USER");
EXPECT_THAT(builder.PreviewRequestHeadersForTesting(),
StrEq("Content-Type: application/json; charset=UTF-8\r\n"
"\r\n"));
EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
EqualsJSON("{"
- " \"response_detail_level\": \"STANDARD\","
- " \"advanced_options\": {"
- " \"local_scoring_params\": {"
- " \"content_restricts\": ["
- " {"
- " \"type\": \"METADATA\","
- " \"value\": \"TITLE\""
- " },"
- " {"
- " \"type\": \"METADATA\","
- " \"value\": \"SNIPPET\""
- " },"
- " {"
- " \"type\": \"METADATA\","
- " \"value\": \"THUMBNAIL\""
- " }"
- " ]"
- " },"
- " \"global_scoring_params\": {"
- " \"num_to_return\": 10,"
- " \"sort_type\": 1"
- " }"
- " }"
- "}"));
-
- builder.SetFetchAPI(FetchAPI::CHROME_CONTENT_SUGGESTIONS_API);
- EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
- EqualsJSON("{"
" \"priority\": \"USER_ACTION\","
" \"excludedSuggestionIds\": [],"
" \"userActivenessClass\": \"ACTIVE_NTP_USER\""
@@ -217,9 +155,7 @@ TEST_F(JsonRequestTest, BuildRequestExcludedIds) {
for (int i = 0; i < 200; ++i) {
params.excluded_ids.insert(base::StringPrintf("%03d", i));
}
- builder.SetParams(params)
- .SetUserClassForTesting("ACTIVE_NTP_USER")
- .SetFetchAPI(FetchAPI::CHROME_CONTENT_SUGGESTIONS_API);
+ builder.SetParams(params).SetUserClassForTesting("ACTIVE_NTP_USER");
EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
EqualsJSON("{"
@@ -256,8 +192,7 @@ TEST_F(JsonRequestTest, BuildRequestNoUserClass) {
JsonRequest::Builder builder;
RequestParams params;
params.interactive_request = false;
- builder.SetParams(params)
- .SetFetchAPI(FetchAPI::CHROME_CONTENT_SUGGESTIONS_API);
+ builder.SetParams(params);
EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
EqualsJSON("{"
@@ -273,9 +208,7 @@ TEST_F(JsonRequestTest, BuildRequestWithTwoLanguages) {
RequestParams params;
params.interactive_request = true;
params.language_code = "en";
- builder.SetParams(params)
- .SetLanguageModel(language_model.get())
- .SetFetchAPI(FetchAPI::CHROME_CONTENT_SUGGESTIONS_API);
+ builder.SetParams(params).SetLanguageModel(language_model.get());
EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
EqualsJSON("{"
@@ -302,9 +235,7 @@ TEST_F(JsonRequestTest, BuildRequestWithUILanguageOnly) {
RequestParams params;
params.interactive_request = true;
params.language_code = "en";
- builder.SetParams(params)
- .SetLanguageModel(language_model.get())
- .SetFetchAPI(FetchAPI::CHROME_CONTENT_SUGGESTIONS_API);
+ builder.SetParams(params).SetLanguageModel(language_model.get());
EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
EqualsJSON("{"
« no previous file with comments | « components/ntp_snippets/remote/json_request.cc ('k') | components/ntp_snippets/remote/remote_suggestions_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698