| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/browser/image_holder.h" | 7 #include "chrome/browser/image_holder.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| 11 | 11 |
| 12 const char kIconUrl1[] = "http://www.google.com/icon1.jpg"; | 12 const char kIconUrl1[] = "http://www.google.com/icon1.jpg"; |
| 13 const char kIconUrl2[] = "http://www.google.com/icon2.jpg"; | 13 const char kIconUrl2[] = "http://www.google.com/icon2.jpg"; |
| 14 | 14 |
| 15 class TestDelegate : public chrome::ImageHolderDelegate { | 15 class TestDelegate : public chrome::ImageHolderDelegate { |
| 16 public: | 16 public: |
| 17 TestDelegate() : on_fetch_complete_called_(false) {} | 17 TestDelegate() : on_fetch_complete_called_(false) {} |
| 18 virtual void OnFetchComplete() override { | 18 void OnFetchComplete() override { on_fetch_complete_called_ = true; } |
| 19 on_fetch_complete_called_ = true; | |
| 20 } | |
| 21 bool on_fetch_complete_called_; | 19 bool on_fetch_complete_called_; |
| 22 }; | 20 }; |
| 23 | 21 |
| 24 } // namespace. | 22 } // namespace. |
| 25 | 23 |
| 26 namespace chrome { | 24 namespace chrome { |
| 27 | 25 |
| 28 typedef testing::Test ImageHolderTest; | 26 typedef testing::Test ImageHolderTest; |
| 29 | 27 |
| 30 TEST_F(ImageHolderTest, CreateBitmapFetcherTest) { | 28 TEST_F(ImageHolderTest, CreateBitmapFetcherTest) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 image_holder2.OnFetchComplete(GURL(kIconUrl2), &bitmap); | 91 image_holder2.OnFetchComplete(GURL(kIconUrl2), &bitmap); |
| 94 image_holder3.OnFetchComplete(GURL(kIconUrl2), &bitmap); | 92 image_holder3.OnFetchComplete(GURL(kIconUrl2), &bitmap); |
| 95 image_holder4.OnFetchComplete(GURL(kIconUrl2), &bitmap); | 93 image_holder4.OnFetchComplete(GURL(kIconUrl2), &bitmap); |
| 96 EXPECT_TRUE(image_holder1.IsFetchingDone()); | 94 EXPECT_TRUE(image_holder1.IsFetchingDone()); |
| 97 EXPECT_TRUE(image_holder2.IsFetchingDone()); | 95 EXPECT_TRUE(image_holder2.IsFetchingDone()); |
| 98 EXPECT_TRUE(image_holder3.IsFetchingDone()); | 96 EXPECT_TRUE(image_holder3.IsFetchingDone()); |
| 99 EXPECT_TRUE(image_holder4.IsFetchingDone()); | 97 EXPECT_TRUE(image_holder4.IsFetchingDone()); |
| 100 } | 98 } |
| 101 | 99 |
| 102 } // namespace chrome. | 100 } // namespace chrome. |
| OLD | NEW |