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

Unified Diff: components/favicon/core/favicon_handler.h

Issue 2703603002: Improve FaviconHandler tests by testing public API (Closed)
Patch Set: Created 3 years, 10 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
Index: components/favicon/core/favicon_handler.h
diff --git a/components/favicon/core/favicon_handler.h b/components/favicon/core/favicon_handler.h
index cfaba62ae07a2176d68574b68e3b0e00ab3ed3db..6dec1658eca620345cf417011d4a1ec382efc27d 100644
--- a/components/favicon/core/favicon_handler.h
+++ b/components/favicon/core/favicon_handler.h
@@ -27,7 +27,6 @@ class SkBitmap;
namespace favicon {
class FaviconService;
-class TestFaviconHandler;
// FaviconHandler works with FaviconDriver to fetch the specific type of
// favicon.
@@ -121,7 +120,7 @@ class FaviconHandler {
FaviconHandler(FaviconService* service,
Delegate* delegate,
FaviconDriverObserver::NotificationIconType handler_type);
- virtual ~FaviconHandler();
+ ~FaviconHandler();
// Initiates loading the favicon for the specified url.
void FetchFavicon(const GURL& url);
@@ -131,51 +130,11 @@ class FaviconHandler {
void OnUpdateFaviconURL(const GURL& page_url,
const std::vector<favicon::FaviconURL>& candidates);
- // For testing.
- const std::vector<favicon::FaviconURL>& image_urls() const {
- return image_urls_;
- }
-
// Returns whether the handler is waiting for a download to complete or for
// data from the FaviconService. Reserved for testing.
bool HasPendingTasksForTest();
- protected:
- // These virtual methods make FaviconHandler testable and are overridden by
- // TestFaviconHandler.
-
- // Ask the favicon from history
- virtual void UpdateFaviconMappingAndFetch(
- const GURL& page_url,
- const GURL& icon_url,
- favicon_base::IconType icon_type,
- const favicon_base::FaviconResultsCallback& callback,
- base::CancelableTaskTracker* tracker);
-
- virtual void GetFaviconFromFaviconService(
- const GURL& icon_url,
- favicon_base::IconType icon_type,
- const favicon_base::FaviconResultsCallback& callback,
- base::CancelableTaskTracker* tracker);
-
- virtual void GetFaviconForURLFromFaviconService(
- const GURL& page_url,
- int icon_types,
- const favicon_base::FaviconResultsCallback& callback,
- base::CancelableTaskTracker* tracker);
-
- virtual void SetHistoryFavicons(const GURL& page_url,
- const GURL& icon_url,
- favicon_base::IconType icon_type,
- const gfx::Image& image);
-
- // Returns true if the favicon should be saved.
- virtual bool ShouldSaveFavicon();
-
private:
- // For testing:
- friend class TestFaviconHandler;
-
// Represents an in progress download of an image from the renderer.
struct DownloadRequest {
DownloadRequest();
@@ -241,6 +200,8 @@ class FaviconHandler {
const std::vector<SkBitmap>& bitmaps,
const std::vector<gfx::Size>& original_bitmap_sizes);
+ bool ShouldSaveFavicon();
+
// Updates |favicon_candidate_| and returns true if it is an exact match.
bool UpdateFaviconCandidate(const GURL& image_url,
const gfx::Image& image,

Powered by Google App Engine
This is Rietveld 408576698