| 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 "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" | 5 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher_service.h" |
| 6 | 6 |
| 7 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" | 7 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
| 8 #include "chrome/test/base/testing_profile.h" | 8 #include "chrome/test/base/testing_profile.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 chrome::BitmapFetcher* CreateFetcher(const GURL& url) override { | 41 chrome::BitmapFetcher* CreateFetcher(const GURL& url) override { |
| 42 return new chrome::BitmapFetcher(url, this); | 42 return new chrome::BitmapFetcher(url, this); |
| 43 } | 43 } |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 class BitmapFetcherServiceTest : public testing::Test, | 48 class BitmapFetcherServiceTest : public testing::Test, |
| 49 public TestNotificationInterface { | 49 public TestNotificationInterface { |
| 50 public: | 50 public: |
| 51 virtual void SetUp() override { | 51 void SetUp() override { |
| 52 service_.reset(new TestService(&profile_)); | 52 service_.reset(new TestService(&profile_)); |
| 53 requestsFinished_ = 0; | 53 requestsFinished_ = 0; |
| 54 imagesChanged_ = 0; | 54 imagesChanged_ = 0; |
| 55 url1_ = GURL("http://example.org/sample-image-1.png"); | 55 url1_ = GURL("http://example.org/sample-image-1.png"); |
| 56 url2_ = GURL("http://example.org/sample-image-2.png"); | 56 url2_ = GURL("http://example.org/sample-image-2.png"); |
| 57 } | 57 } |
| 58 | 58 |
| 59 const ScopedVector<BitmapFetcherRequest>& requests() { | 59 const ScopedVector<BitmapFetcherRequest>& requests() { |
| 60 return service_->requests_; | 60 return service_->requests_; |
| 61 } | 61 } |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 service_->RequestImage(url1_, new TestObserver(this)); | 163 service_->RequestImage(url1_, new TestObserver(this)); |
| 164 service_->RequestImage(url2_, new TestObserver(this)); | 164 service_->RequestImage(url2_, new TestObserver(this)); |
| 165 EXPECT_EQ(0U, cache_size()); | 165 EXPECT_EQ(0U, cache_size()); |
| 166 | 166 |
| 167 CompleteFetch(url1_); | 167 CompleteFetch(url1_); |
| 168 EXPECT_EQ(1U, cache_size()); | 168 EXPECT_EQ(1U, cache_size()); |
| 169 | 169 |
| 170 FailFetch(url2_); | 170 FailFetch(url2_); |
| 171 EXPECT_EQ(1U, cache_size()); | 171 EXPECT_EQ(1U, cache_size()); |
| 172 } | 172 } |
| OLD | NEW |