| OLD | NEW |
| 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/doodle/doodle_fetcher_impl.h" | 5 #include "components/doodle/doodle_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 base::TimeDelta time_to_live; | 191 base::TimeDelta time_to_live; |
| 192 base::Optional<DoodleConfig> response; | 192 base::Optional<DoodleConfig> response; |
| 193 EXPECT_CALL(callback, Run(_, _, _)) | 193 EXPECT_CALL(callback, Run(_, _, _)) |
| 194 .WillOnce(DoAll(SaveArg<0>(&state), SaveArg<1>(&time_to_live), | 194 .WillOnce(DoAll(SaveArg<0>(&state), SaveArg<1>(&time_to_live), |
| 195 SaveArg<2>(&response))); | 195 SaveArg<2>(&response))); |
| 196 RespondWithData(R"json()]}'{ | 196 RespondWithData(R"json()]}'{ |
| 197 "ddljson": { | 197 "ddljson": { |
| 198 "alt_text":"Mouseover Text", | 198 "alt_text":"Mouseover Text", |
| 199 "doodle_type":"SIMPLE", | 199 "doodle_type":"SIMPLE", |
| 200 "interactive_html":"\u003cstyle\u003e\u003c\/style\u003e", | 200 "interactive_html":"\u003cstyle\u003e\u003c\/style\u003e", |
| 201 "search_url":"/search?q\u003dtest", | |
| 202 "target_url":"/search?q\u003dtest\u0026sa\u003dX\u0026ved\u003d0ahUKEw", | 201 "target_url":"/search?q\u003dtest\u0026sa\u003dX\u0026ved\u003d0ahUKEw", |
| 203 "time_to_live_ms":55000, | 202 "time_to_live_ms":55000, |
| 204 "large_image": { | 203 "large_image": { |
| 205 "url":"/logos/doodles/2015/new-years-eve-2015-59854387958251-hp.gif" | 204 "url":"/logos/doodles/2015/new-years-eve-2015-59854387958251-hp.gif" |
| 206 } | 205 } |
| 207 }})json"); | 206 }})json"); |
| 208 | 207 |
| 209 EXPECT_THAT(state, Eq(DoodleState::AVAILABLE)); | 208 EXPECT_THAT(state, Eq(DoodleState::AVAILABLE)); |
| 210 ASSERT_TRUE(response.has_value()); | 209 ASSERT_TRUE(response.has_value()); |
| 211 DoodleConfig config = response.value(); | 210 DoodleConfig config = response.value(); |
| 212 | 211 |
| 213 EXPECT_TRUE(config.search_url.is_valid()); | |
| 214 EXPECT_THAT(config.search_url, Eq(Resolve("/search?q\u003dtest"))); | |
| 215 EXPECT_TRUE(config.fullpage_interactive_url.is_empty()); | |
| 216 EXPECT_TRUE(config.target_url.is_valid()); | 212 EXPECT_TRUE(config.target_url.is_valid()); |
| 217 EXPECT_THAT(config.target_url, | 213 EXPECT_THAT(config.target_url, |
| 218 Eq(Resolve("/search?q\u003dtest\u0026sa\u003dX\u0026ved\u003d" | 214 Eq(Resolve("/search?q\u003dtest\u0026sa\u003dX\u0026ved\u003d" |
| 219 "0ahUKEw"))); | 215 "0ahUKEw"))); |
| 220 EXPECT_THAT(config.doodle_type, Eq(DoodleType::SIMPLE)); | 216 EXPECT_THAT(config.doodle_type, Eq(DoodleType::SIMPLE)); |
| 221 EXPECT_THAT(config.alt_text, Eq("Mouseover Text")); | 217 EXPECT_THAT(config.alt_text, Eq("Mouseover Text")); |
| 222 EXPECT_THAT(config.interactive_html, | 218 EXPECT_THAT(config.interactive_html, |
| 223 Eq("\u003cstyle\u003e\u003c/style\u003e")); | 219 Eq("\u003cstyle\u003e\u003c/style\u003e")); |
| 224 | 220 |
| 225 EXPECT_FALSE(config.large_cta_image.has_value()); | 221 EXPECT_FALSE(config.large_cta_image.has_value()); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 449 |
| 454 TEST_F(DoodleFetcherImplNoGrayBgTest, PassesNoGrayBgParam) { | 450 TEST_F(DoodleFetcherImplNoGrayBgTest, PassesNoGrayBgParam) { |
| 455 base::MockCallback<DoodleFetcherImpl::FinishedCallback> callback; | 451 base::MockCallback<DoodleFetcherImpl::FinishedCallback> callback; |
| 456 doodle_fetcher()->FetchDoodle(callback.Get()); | 452 doodle_fetcher()->FetchDoodle(callback.Get()); |
| 457 | 453 |
| 458 EXPECT_THAT(GetRunningFetcher()->GetOriginalURL(), | 454 EXPECT_THAT(GetRunningFetcher()->GetOriginalURL(), |
| 459 Eq(Resolve(kDoodleConfigPathNoGrayBg))); | 455 Eq(Resolve(kDoodleConfigPathNoGrayBg))); |
| 460 } | 456 } |
| 461 | 457 |
| 462 } // namespace doodle | 458 } // namespace doodle |
| OLD | NEW |