Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc

Issue 341083008: [AiS] Fix ownership issue for image service observers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@img-bridge
Patch Set: Re-upload. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc
diff --git a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc
index 16be0c6053e74bf17cad755f96479b11988f1e1e..1a3549773d24b6919be3f8428e0ff497cb5bc920 100644
--- a/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc
+++ b/chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc
@@ -10,18 +10,24 @@
namespace {
+class TestNotificationInterface {
+ public:
+ virtual ~TestNotificationInterface() {}
+ virtual void OnImageChanged() = 0;
+ virtual void OnRequestFinished() = 0;
+};
+
class TestObserver : public BitmapFetcherService::Observer {
public:
- explicit TestObserver(BitmapFetcherService::Observer* target)
- : target_(target) {}
- virtual ~TestObserver() {}
+ explicit TestObserver(TestNotificationInterface* target) : target_(target) {}
+ virtual ~TestObserver() { target_->OnRequestFinished(); }
virtual void OnImageChanged(BitmapFetcherService::RequestId request_id,
const SkBitmap& answers_image) OVERRIDE {
- target_->OnImageChanged(request_id, answers_image);
+ target_->OnImageChanged();
}
- BitmapFetcherService::Observer* target_;
+ TestNotificationInterface* target_;
};
class TestService : public BitmapFetcherService {
@@ -40,7 +46,7 @@ class TestService : public BitmapFetcherService {
} // namespace
class BitmapFetcherServiceTest : public testing::Test,
- public BitmapFetcherService::Observer {
+ public TestNotificationInterface {
public:
virtual void SetUp() OVERRIDE {
service_.reset(new TestService(&profile_));
@@ -58,13 +64,9 @@ class BitmapFetcherServiceTest : public testing::Test,
}
size_t cache_size() { return service_->cache_.size(); }
- virtual void OnImageChanged(BitmapFetcherService::RequestId request_id,
- const SkBitmap& answers_image) OVERRIDE {
- if (answers_image.empty())
- requestsFinished_++;
- else
- imagesChanged_++;
- }
+ virtual void OnImageChanged() OVERRIDE { imagesChanged_++; }
+
+ virtual void OnRequestFinished() OVERRIDE { requestsFinished_++; }
// Simulate finishing a URL fetch and decode for the given fetcher.
void CompleteFetch(const GURL& url) {
« no previous file with comments | « chrome/browser/bitmap_fetcher/bitmap_fetcher_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698