Index: chrome/browser/favicon/favicon_handler_unittest.cc |
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc |
index b844055a332a0d1efe50aabc867bbaef5b31de3d..3bcc49b6e9c23d02409aec7c42de25f65676beed 100644 |
--- a/chrome/browser/favicon/favicon_handler_unittest.cc |
+++ b/chrome/browser/favicon/favicon_handler_unittest.cc |
@@ -172,6 +172,14 @@ class TestFaviconDriver : public FaviconDriver { |
virtual bool IsOffTheRecord() OVERRIDE { return false; } |
}; |
+class TestFaviconClient : public FaviconClient { |
+ public: |
+ virtual FaviconService* GetFaviconService() OVERRIDE { |
+ // Just give none NULL value, so overridden methods can be hit. |
+ return (FaviconService*)(1); |
+ } |
+}; |
+ |
class TestFaviconHandlerDelegate : public FaviconHandlerDelegate { |
public: |
TestFaviconHandlerDelegate() { |
@@ -209,10 +217,11 @@ class TestFaviconHandler : public FaviconHandler { |
public: |
TestFaviconHandler(const GURL& page_url, |
Profile* profile, |
+ FaviconClient* client, |
FaviconDriver* driver, |
FaviconHandlerDelegate* delegate, |
Type type) |
- : FaviconHandler(profile, driver, delegate, type), |
+ : FaviconHandler(profile, client, driver, delegate, type), |
entry_(NavigationEntry::Create()), |
download_id_(0), |
num_favicon_updates_(0) { |
@@ -305,11 +314,6 @@ class TestFaviconHandler : public FaviconHandler { |
page_url, icon_url, icon_type, bitmap_data)); |
} |
- virtual FaviconService* GetFaviconService() OVERRIDE { |
- // Just give none NULL value, so overridden methods can be hit. |
- return (FaviconService*)(1); |
- } |
- |
virtual bool ShouldSaveFavicon(const GURL& url) OVERRIDE { |
return true; |
} |
@@ -442,11 +446,12 @@ TEST_F(FaviconHandlerTest, GetFaviconFromHistory) { |
const GURL icon_url("http://www.google.com/favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::FAVICON); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::FAVICON); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -485,11 +490,12 @@ TEST_F(FaviconHandlerTest, DownloadFavicon) { |
const GURL icon_url("http://www.google.com/favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::FAVICON); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::FAVICON); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -555,11 +561,12 @@ TEST_F(FaviconHandlerTest, UpdateAndDownloadFavicon) { |
const GURL new_icon_url("http://www.google.com/new_favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::FAVICON); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::FAVICON); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -639,11 +646,12 @@ TEST_F(FaviconHandlerTest, FaviconInHistoryInvalid) { |
const GURL icon_url("http://www.google.com/favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::FAVICON); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::FAVICON); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -714,11 +722,12 @@ TEST_F(FaviconHandlerTest, UpdateFavicon) { |
const GURL new_icon_url("http://www.google.com/new_favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::FAVICON); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::FAVICON); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -778,11 +787,12 @@ TEST_F(FaviconHandlerTest, Download2ndFaviconURLCandidate) { |
const GURL new_icon_url("http://www.google.com/new_favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::TOUCH); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::TOUCH); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -892,11 +902,12 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) { |
const GURL new_icon_url("http://www.google.com/new_favicon"); |
TestFaviconHandlerDelegate delegate; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
Profile* profile = Profile::FromBrowserContext( |
web_contents()->GetBrowserContext()); |
TestFaviconHandler helper( |
- page_url, profile, &driver, &delegate, FaviconHandler::TOUCH); |
+ page_url, profile, &client, &driver, &delegate, FaviconHandler::TOUCH); |
helper.FetchFavicon(page_url); |
HistoryRequestHandler* history_handler = helper.history_handler(); |
@@ -1037,9 +1048,10 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { |
// 1) Test that if there are several single resolution favicons to choose from |
// that the largest exact match is chosen. |
TestFaviconHandlerDelegate delegate1; |
+ TestFaviconClient client; |
TestFaviconDriver driver; |
TestFaviconHandler handler1( |
- kPageURL, profile, &driver, &delegate1, FaviconHandler::FAVICON); |
+ kPageURL, profile, &client, &driver, &delegate1, FaviconHandler::FAVICON); |
const int kSizes1[] = { 16, 24, 32, 48, 256 }; |
std::vector<FaviconURL> urls1(kSourceIconURLs, |
kSourceIconURLs + arraysize(kSizes1)); |
@@ -1060,7 +1072,7 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { |
// from, the exact match is preferred even if it results in upsampling. |
TestFaviconHandlerDelegate delegate2; |
TestFaviconHandler handler2( |
- kPageURL, profile, &driver, &delegate2, FaviconHandler::FAVICON); |
+ kPageURL, profile, &client, &driver, &delegate2, FaviconHandler::FAVICON); |
const int kSizes2[] = { 16, 24, 48, 256 }; |
std::vector<FaviconURL> urls2(kSourceIconURLs, |
kSourceIconURLs + arraysize(kSizes2)); |
@@ -1075,7 +1087,7 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { |
// a little are preferred over huge favicons. |
TestFaviconHandlerDelegate delegate3; |
TestFaviconHandler handler3( |
- kPageURL, profile, &driver, &delegate3, FaviconHandler::FAVICON); |
+ kPageURL, profile, &client, &driver, &delegate3, FaviconHandler::FAVICON); |
const int kSizes3[] = { 256, 48 }; |
std::vector<FaviconURL> urls3(kSourceIconURLs, |
kSourceIconURLs + arraysize(kSizes3)); |
@@ -1088,7 +1100,7 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) { |
TestFaviconHandlerDelegate delegate4; |
TestFaviconHandler handler4( |
- kPageURL, profile, &driver, &delegate4, FaviconHandler::FAVICON); |
+ kPageURL, profile, &client, &driver, &delegate4, FaviconHandler::FAVICON); |
const int kSizes4[] = { 17, 256 }; |
std::vector<FaviconURL> urls4(kSourceIconURLs, |
kSourceIconURLs + arraysize(kSizes4)); |