| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 EXPECT_CALL(*this, OnObserverRemoved()).Times(1); | 270 EXPECT_CALL(*this, OnObserverRemoved()).Times(1); |
| 271 } | 271 } |
| 272 | 272 |
| 273 MOCK_METHOD2(OnLogoAvailable, void(const Logo*, bool)); | 273 MOCK_METHOD2(OnLogoAvailable, void(const Logo*, bool)); |
| 274 MOCK_METHOD0(OnObserverRemoved, void()); | 274 MOCK_METHOD0(OnObserverRemoved, void()); |
| 275 }; | 275 }; |
| 276 | 276 |
| 277 class TestLogoDelegate : public LogoDelegate { | 277 class TestLogoDelegate : public LogoDelegate { |
| 278 public: | 278 public: |
| 279 TestLogoDelegate() {} | 279 TestLogoDelegate() {} |
| 280 virtual ~TestLogoDelegate() {} | 280 ~TestLogoDelegate() override {} |
| 281 | 281 |
| 282 virtual void DecodeUntrustedImage( | 282 void DecodeUntrustedImage( |
| 283 const scoped_refptr<base::RefCountedString>& encoded_image, | 283 const scoped_refptr<base::RefCountedString>& encoded_image, |
| 284 base::Callback<void(const SkBitmap&)> image_decoded_callback) override { | 284 base::Callback<void(const SkBitmap&)> image_decoded_callback) override { |
| 285 SkBitmap bitmap = | 285 SkBitmap bitmap = |
| 286 gfx::Image::CreateFrom1xPNGBytes(encoded_image->front(), | 286 gfx::Image::CreateFrom1xPNGBytes(encoded_image->front(), |
| 287 encoded_image->size()).AsBitmap(); | 287 encoded_image->size()).AsBitmap(); |
| 288 base::MessageLoopProxy::current()->PostTask( | 288 base::MessageLoopProxy::current()->PostTask( |
| 289 FROM_HERE, base::Bind(image_decoded_callback, bitmap)); | 289 FROM_HERE, base::Bind(image_decoded_callback, bitmap)); |
| 290 } | 290 } |
| 291 }; | 291 }; |
| 292 | 292 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 MockLogoObserver listener2; | 668 MockLogoObserver listener2; |
| 669 listener2.ExpectFreshLogo(&logo); | 669 listener2.ExpectFreshLogo(&logo); |
| 670 logo_tracker_->GetLogo(&listener2); | 670 logo_tracker_->GetLogo(&listener2); |
| 671 | 671 |
| 672 base::RunLoop().RunUntilIdle(); | 672 base::RunLoop().RunUntilIdle(); |
| 673 } | 673 } |
| 674 | 674 |
| 675 } // namespace | 675 } // namespace |
| 676 | 676 |
| 677 } // namespace search_provider_logos | 677 } // namespace search_provider_logos |
| OLD | NEW |