| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/search_provider_logos/logo_tracker.h" | 5 #include "components/search_provider_logos/logo_tracker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 GURL url_with_fp = GoogleAppendQueryparamsToLogoURL( | 421 GURL url_with_fp = GoogleAppendQueryparamsToLogoURL( |
| 422 GURL("http://logourl.com/path"), "abc123", true); | 422 GURL("http://logourl.com/path"), "abc123", true); |
| 423 EXPECT_EQ("http://logourl.com/path?async=es_dfp:abc123,cta:1", | 423 EXPECT_EQ("http://logourl.com/path?async=es_dfp:abc123,cta:1", |
| 424 url_with_fp.spec()); | 424 url_with_fp.spec()); |
| 425 | 425 |
| 426 url_with_fp = GoogleAppendQueryparamsToLogoURL( | 426 url_with_fp = GoogleAppendQueryparamsToLogoURL( |
| 427 GURL("http://logourl.com/?a=b"), "", true); | 427 GURL("http://logourl.com/?a=b"), "", true); |
| 428 EXPECT_EQ("http://logourl.com/?a=b&async=cta:1", url_with_fp.spec()); | 428 EXPECT_EQ("http://logourl.com/?a=b&async=cta:1", url_with_fp.spec()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 TEST_F(LogoTrackerTest, CTATransparentHasCommas) { |
| 432 GURL url_with_fp = GoogleAppendQueryparamsToLogoURL( |
| 433 GURL("http://logourl.com/path"), "abc123", true, true); |
| 434 EXPECT_EQ("http://logourl.com/path?async=es_dfp:abc123,cta:1,transp:1", |
| 435 url_with_fp.spec()); |
| 436 |
| 437 url_with_fp = GoogleAppendQueryparamsToLogoURL( |
| 438 GURL("http://logourl.com/?a=b"), "", true, true); |
| 439 EXPECT_EQ("http://logourl.com/?a=b&async=cta:1,transp:1", url_with_fp.spec()); |
| 440 } |
| 441 |
| 431 TEST_F(LogoTrackerTest, DownloadAndCacheLogo) { | 442 TEST_F(LogoTrackerTest, DownloadAndCacheLogo) { |
| 432 Logo logo = GetSampleLogo(logo_url_, test_clock_->Now()); | 443 Logo logo = GetSampleLogo(logo_url_, test_clock_->Now()); |
| 433 SetServerResponse(ServerResponse(logo)); | 444 SetServerResponse(ServerResponse(logo)); |
| 434 logo_cache_->ExpectSetCachedLogo(&logo); | 445 logo_cache_->ExpectSetCachedLogo(&logo); |
| 435 observer_.ExpectFreshLogo(&logo); | 446 observer_.ExpectFreshLogo(&logo); |
| 436 GetLogo(); | 447 GetLogo(); |
| 437 } | 448 } |
| 438 | 449 |
| 439 TEST_F(LogoTrackerTest, EmptyCacheAndFailedDownload) { | 450 TEST_F(LogoTrackerTest, EmptyCacheAndFailedDownload) { |
| 440 EXPECT_CALL(*logo_cache_, UpdateCachedLogoMetadata(_)).Times(0); | 451 EXPECT_CALL(*logo_cache_, UpdateCachedLogoMetadata(_)).Times(0); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 MockLogoObserver listener2; | 750 MockLogoObserver listener2; |
| 740 listener2.ExpectFreshLogo(&logo); | 751 listener2.ExpectFreshLogo(&logo); |
| 741 logo_tracker_->GetLogo(&listener2); | 752 logo_tracker_->GetLogo(&listener2); |
| 742 | 753 |
| 743 base::RunLoop().RunUntilIdle(); | 754 base::RunLoop().RunUntilIdle(); |
| 744 } | 755 } |
| 745 | 756 |
| 746 } // namespace | 757 } // namespace |
| 747 | 758 |
| 748 } // namespace search_provider_logos | 759 } // namespace search_provider_logos |
| OLD | NEW |