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

Side by Side Diff: chrome/browser/bitmap_fetcher/bitmap_fetcher_service_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce to test fixes only. Created 5 years, 8 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 unified diff | Download patch
OLDNEW
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 "content/public/test/test_browser_thread_bundle.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 11
11 namespace { 12 namespace {
12 13
13 class TestNotificationInterface { 14 class TestNotificationInterface {
14 public: 15 public:
15 virtual ~TestNotificationInterface() {} 16 virtual ~TestNotificationInterface() {}
16 virtual void OnImageChanged() = 0; 17 virtual void OnImageChanged() = 0;
17 virtual void OnRequestFinished() = 0; 18 virtual void OnRequestFinished() = 0;
18 }; 19 };
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 protected: 91 protected:
91 scoped_ptr<BitmapFetcherService> service_; 92 scoped_ptr<BitmapFetcherService> service_;
92 93
93 int imagesChanged_; 94 int imagesChanged_;
94 int requestsFinished_; 95 int requestsFinished_;
95 96
96 GURL url1_; 97 GURL url1_;
97 GURL url2_; 98 GURL url2_;
98 99
99 private: 100 private:
101 content::TestBrowserThreadBundle thread_bundle_;
100 TestingProfile profile_; 102 TestingProfile profile_;
101 }; 103 };
102 104
103 TEST_F(BitmapFetcherServiceTest, RequestInvalidUrl) { 105 TEST_F(BitmapFetcherServiceTest, RequestInvalidUrl) {
104 const BitmapFetcherService::RequestId invalid_request_id = 106 const BitmapFetcherService::RequestId invalid_request_id =
105 BitmapFetcherService::REQUEST_ID_INVALID; 107 BitmapFetcherService::REQUEST_ID_INVALID;
106 GURL invalid_url; 108 GURL invalid_url;
107 ASSERT_FALSE(invalid_url.is_valid()); 109 ASSERT_FALSE(invalid_url.is_valid());
108 110
109 BitmapFetcherService::RequestId request_id = 111 BitmapFetcherService::RequestId request_id =
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 service_->RequestImage(url1_, new TestObserver(this)); 164 service_->RequestImage(url1_, new TestObserver(this));
163 service_->RequestImage(url2_, new TestObserver(this)); 165 service_->RequestImage(url2_, new TestObserver(this));
164 EXPECT_EQ(0U, cache_size()); 166 EXPECT_EQ(0U, cache_size());
165 167
166 CompleteFetch(url1_); 168 CompleteFetch(url1_);
167 EXPECT_EQ(1U, cache_size()); 169 EXPECT_EQ(1U, cache_size());
168 170
169 FailFetch(url2_); 171 FailFetch(url2_);
170 EXPECT_EQ(1U, cache_size()); 172 EXPECT_EQ(1U, cache_size());
171 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698