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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 : url1_(GURL("http://example.org/sample-image-1.png")), | 65 : url1_(GURL("http://example.org/sample-image-1.png")), |
66 url2_(GURL("http://example.org/sample-image-2.png")) { | 66 url2_(GURL("http://example.org/sample-image-2.png")) { |
67 } | 67 } |
68 | 68 |
69 void SetUp() override { | 69 void SetUp() override { |
70 service_.reset(new TestService(&profile_)); | 70 service_.reset(new TestService(&profile_)); |
71 requests_finished_ = 0; | 71 requests_finished_ = 0; |
72 images_changed_ = 0; | 72 images_changed_ = 0; |
73 } | 73 } |
74 | 74 |
75 const ScopedVector<BitmapFetcherRequest>& requests() const { | 75 const std::vector<std::unique_ptr<BitmapFetcherRequest>>& requests() const { |
76 return service_->requests_; | 76 return service_->requests_; |
77 } | 77 } |
78 const std::vector<std::unique_ptr<chrome::BitmapFetcher>>& active_fetchers() | 78 const std::vector<std::unique_ptr<chrome::BitmapFetcher>>& active_fetchers() |
79 const { | 79 const { |
80 return service_->active_fetchers_; | 80 return service_->active_fetchers_; |
81 } | 81 } |
82 size_t cache_size() const { return service_->cache_.size(); } | 82 size_t cache_size() const { return service_->cache_.size(); } |
83 | 83 |
84 void OnImageChanged() override { images_changed_++; } | 84 void OnImageChanged() override { images_changed_++; } |
85 | 85 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 service_->RequestImage(url2_, new TestObserver(this), | 212 service_->RequestImage(url2_, new TestObserver(this), |
213 TRAFFIC_ANNOTATION_FOR_TESTS); | 213 TRAFFIC_ANNOTATION_FOR_TESTS); |
214 EXPECT_EQ(0U, cache_size()); | 214 EXPECT_EQ(0U, cache_size()); |
215 | 215 |
216 CompleteFetch(url1_); | 216 CompleteFetch(url1_); |
217 EXPECT_EQ(1U, cache_size()); | 217 EXPECT_EQ(1U, cache_size()); |
218 | 218 |
219 FailFetch(url2_); | 219 FailFetch(url2_); |
220 EXPECT_EQ(1U, cache_size()); | 220 EXPECT_EQ(1U, cache_size()); |
221 } | 221 } |
OLD | NEW |