OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "chrome/browser/favicon/favicon_handler.h" | 6 #include "chrome/browser/favicon/favicon_handler.h" |
7 #include "chrome/browser/favicon/favicon_service_factory.h" | 7 #include "chrome/browser/favicon/favicon_service_factory.h" |
8 #include "chrome/browser/history/history_service_factory.h" | 8 #include "chrome/browser/history/history_service_factory.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 FaviconURL* current_candidate() { | 251 FaviconURL* current_candidate() { |
252 return FaviconHandler::current_candidate(); | 252 return FaviconHandler::current_candidate(); |
253 } | 253 } |
254 | 254 |
255 protected: | 255 protected: |
256 virtual void UpdateFaviconMappingAndFetch( | 256 virtual void UpdateFaviconMappingAndFetch( |
257 const GURL& page_url, | 257 const GURL& page_url, |
258 const GURL& icon_url, | 258 const GURL& icon_url, |
259 chrome::IconType icon_type, | 259 chrome::IconType icon_type, |
260 const FaviconService::FaviconResultsCallback& callback, | 260 const FaviconService::FaviconResultsCallback& callback, |
261 CancelableTaskTracker* tracker) OVERRIDE { | 261 base::CancelableTaskTracker* tracker) OVERRIDE { |
262 history_handler_.reset(new HistoryRequestHandler(page_url, icon_url, | 262 history_handler_.reset(new HistoryRequestHandler(page_url, icon_url, |
263 icon_type, callback)); | 263 icon_type, callback)); |
264 } | 264 } |
265 | 265 |
266 virtual void GetFavicon( | 266 virtual void GetFavicon( |
267 const GURL& icon_url, | 267 const GURL& icon_url, |
268 chrome::IconType icon_type, | 268 chrome::IconType icon_type, |
269 const FaviconService::FaviconResultsCallback& callback, | 269 const FaviconService::FaviconResultsCallback& callback, |
270 CancelableTaskTracker* tracker) OVERRIDE { | 270 base::CancelableTaskTracker* tracker) OVERRIDE { |
271 history_handler_.reset(new HistoryRequestHandler(GURL(), icon_url, | 271 history_handler_.reset(new HistoryRequestHandler(GURL(), icon_url, |
272 icon_type, callback)); | 272 icon_type, callback)); |
273 } | 273 } |
274 | 274 |
275 virtual void GetFaviconForURL( | 275 virtual void GetFaviconForURL( |
276 const GURL& page_url, | 276 const GURL& page_url, |
277 int icon_types, | 277 int icon_types, |
278 const FaviconService::FaviconResultsCallback& callback, | 278 const FaviconService::FaviconResultsCallback& callback, |
279 CancelableTaskTracker* tracker) OVERRIDE { | 279 base::CancelableTaskTracker* tracker) OVERRIDE { |
280 history_handler_.reset(new HistoryRequestHandler(page_url, GURL(), | 280 history_handler_.reset(new HistoryRequestHandler(page_url, GURL(), |
281 icon_types, callback)); | 281 icon_types, callback)); |
282 } | 282 } |
283 | 283 |
284 virtual int DownloadFavicon(const GURL& image_url, | 284 virtual int DownloadFavicon(const GURL& image_url, |
285 int max_bitmap_size) OVERRIDE { | 285 int max_bitmap_size) OVERRIDE { |
286 download_id_++; | 286 download_id_++; |
287 download_handler_->AddDownload( | 287 download_handler_->AddDownload( |
288 download_id_, image_url, 0, max_bitmap_size); | 288 download_id_, image_url, 0, max_bitmap_size); |
289 return download_id_; | 289 return download_id_; |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); | 1147 download_id = favicon_tab_helper->StartDownload(missing_icon_url, 0); |
1148 EXPECT_NE(0, download_id); | 1148 EXPECT_NE(0, download_id); |
1149 // Report download success with HTTP 200 status. | 1149 // Report download success with HTTP 200 status. |
1150 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, | 1150 favicon_tab_helper->DidDownloadFavicon(download_id, 200, missing_icon_url, |
1151 empty_icons, empty_icon_sizes); | 1151 empty_icons, empty_icon_sizes); |
1152 // Icon is not marked as UnableToDownload as HTTP status is not 404. | 1152 // Icon is not marked as UnableToDownload as HTTP status is not 404. |
1153 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); | 1153 EXPECT_FALSE(favicon_service->WasUnableToDownloadFavicon(missing_icon_url)); |
1154 } | 1154 } |
1155 | 1155 |
1156 } // namespace. | 1156 } // namespace. |
OLD | NEW |