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.h" | 5 #include "chrome/browser/bitmap_fetcher/bitmap_fetcher.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 SkBitmap image; | 134 SkBitmap image; |
135 | 135 |
136 // Put a real bitmap into "image". 2x2 bitmap of green 16 bit pixels. | 136 // Put a real bitmap into "image". 2x2 bitmap of green 16 bit pixels. |
137 image.allocN32Pixels(2, 2); | 137 image.allocN32Pixels(2, 2); |
138 image.eraseColor(SK_ColorGREEN); | 138 image.eraseColor(SK_ColorGREEN); |
139 | 139 |
140 BitmapFetcherTestDelegate delegate(kSyncCall); | 140 BitmapFetcherTestDelegate delegate(kSyncCall); |
141 | 141 |
142 BitmapFetcher fetcher(url, &delegate); | 142 BitmapFetcher fetcher(url, &delegate); |
143 | 143 |
144 fetcher.OnImageDecoded(NULL, image); | 144 fetcher.OnImageDecoded(image); |
145 | 145 |
146 // Ensure image is marked as succeeded. | 146 // Ensure image is marked as succeeded. |
147 EXPECT_TRUE(delegate.success()); | 147 EXPECT_TRUE(delegate.success()); |
148 | 148 |
149 // Test that the image is what we expect. | 149 // Test that the image is what we expect. |
150 EXPECT_TRUE(gfx::BitmapsAreEqual(image, delegate.bitmap())); | 150 EXPECT_TRUE(gfx::BitmapsAreEqual(image, delegate.bitmap())); |
151 } | 151 } |
152 | 152 |
153 IN_PROC_BROWSER_TEST_F(BitmapFetcherBrowserTest, OnURLFetchFailureTest) { | 153 IN_PROC_BROWSER_TEST_F(BitmapFetcherBrowserTest, OnURLFetchFailureTest) { |
154 GURL url("http://example.com/this-should-be-fetch-failure"); | 154 GURL url("http://example.com/this-should-be-fetch-failure"); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, | 192 net::URLRequest::CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, |
193 net::LOAD_NORMAL); | 193 net::LOAD_NORMAL); |
194 | 194 |
195 // Blocks until test delegate is notified via a callback. | 195 // Blocks until test delegate is notified via a callback. |
196 delegate.Wait(); | 196 delegate.Wait(); |
197 | 197 |
198 EXPECT_FALSE(delegate.success()); | 198 EXPECT_FALSE(delegate.success()); |
199 } | 199 } |
200 | 200 |
201 } // namespace chrome | 201 } // namespace chrome |
OLD | NEW |