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

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

Issue 2665743002: [Remote suggestions] Clean up variation params in the fetcher. (Closed)
Patch Set: Created 3 years, 10 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/json_request.h" 5 #include "components/ntp_snippets/remote/json_request.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 EXPECT_THAT(builder.PreviewRequestHeadersForTesting(), 122 EXPECT_THAT(builder.PreviewRequestHeadersForTesting(),
123 StrEq("Content-Type: application/json; charset=UTF-8\r\n" 123 StrEq("Content-Type: application/json; charset=UTF-8\r\n"
124 "Authorization: headerstuff\r\n" 124 "Authorization: headerstuff\r\n"
125 "\r\n")); 125 "\r\n"));
126 EXPECT_THAT(builder.PreviewRequestBodyForTesting(), 126 EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
127 EqualsJSON("{" 127 EqualsJSON("{"
128 " \"response_detail_level\": \"STANDARD\"," 128 " \"response_detail_level\": \"STANDARD\","
129 " \"obfuscated_gaia_id\": \"0BFUSGAIA\"," 129 " \"obfuscated_gaia_id\": \"0BFUSGAIA\","
130 " \"advanced_options\": {" 130 " \"advanced_options\": {"
131 " \"local_scoring_params\": {" 131 " \"local_scoring_params\": {"
132 " \"content_params\": {"
133 " \"only_return_personalized_results\": true"
134 " },"
135 " \"content_restricts\": [" 132 " \"content_restricts\": ["
136 " {" 133 " {"
137 " \"type\": \"METADATA\"," 134 " \"type\": \"METADATA\","
138 " \"value\": \"TITLE\"" 135 " \"value\": \"TITLE\""
139 " }," 136 " },"
140 " {" 137 " {"
141 " \"type\": \"METADATA\"," 138 " \"type\": \"METADATA\","
142 " \"value\": \"SNIPPET\"" 139 " \"value\": \"SNIPPET\""
143 " }," 140 " },"
144 " {" 141 " {"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 .SetFetchAPI(FetchAPI::CHROME_READER_API); 174 .SetFetchAPI(FetchAPI::CHROME_READER_API);
178 175
179 EXPECT_THAT(builder.PreviewRequestHeadersForTesting(), 176 EXPECT_THAT(builder.PreviewRequestHeadersForTesting(),
180 StrEq("Content-Type: application/json; charset=UTF-8\r\n" 177 StrEq("Content-Type: application/json; charset=UTF-8\r\n"
181 "\r\n")); 178 "\r\n"));
182 EXPECT_THAT(builder.PreviewRequestBodyForTesting(), 179 EXPECT_THAT(builder.PreviewRequestBodyForTesting(),
183 EqualsJSON("{" 180 EqualsJSON("{"
184 " \"response_detail_level\": \"STANDARD\"," 181 " \"response_detail_level\": \"STANDARD\","
185 " \"advanced_options\": {" 182 " \"advanced_options\": {"
186 " \"local_scoring_params\": {" 183 " \"local_scoring_params\": {"
187 " \"content_params\": {"
188 " \"only_return_personalized_results\": false"
189 " },"
190 " \"content_restricts\": [" 184 " \"content_restricts\": ["
191 " {" 185 " {"
192 " \"type\": \"METADATA\"," 186 " \"type\": \"METADATA\","
193 " \"value\": \"TITLE\"" 187 " \"value\": \"TITLE\""
194 " }," 188 " },"
195 " {" 189 " {"
196 " \"type\": \"METADATA\"," 190 " \"type\": \"METADATA\","
197 " \"value\": \"SNIPPET\"" 191 " \"value\": \"SNIPPET\""
198 " }," 192 " },"
199 " {" 193 " {"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 " \"topLanguages\": [{" 320 " \"topLanguages\": [{"
327 " \"language\" : \"en\"," 321 " \"language\" : \"en\","
328 " \"frequency\" : 1.0" 322 " \"frequency\" : 1.0"
329 " }]" 323 " }]"
330 "}")); 324 "}"));
331 } 325 }
332 326
333 } // namespace internal 327 } // namespace internal
334 328
335 } // namespace ntp_snippets 329 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698