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

Unified Diff: chrome/browser/favicon_helper_unittest.cc

Issue 6883020: Make icon_messages use the IPC macros for defining the structs and the serialization code, and mo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/favicon_helper.cc ('k') | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon_helper_unittest.cc
===================================================================
--- chrome/browser/favicon_helper_unittest.cc (revision 81979)
+++ chrome/browser/favicon_helper_unittest.cc (working copy)
@@ -307,14 +307,14 @@
// Simulates update favicon url.
std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(icon_url, FAVICON));
+ urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON));
DownloadHandler::UpdateFaviconURL(&helper, urls);
// Verify FaviconHelper status
EXPECT_EQ(1U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
ASSERT_EQ(icon_url, helper.current_candidate()->icon_url);
- ASSERT_EQ(FAVICON, helper.current_candidate()->icon_type);
+ ASSERT_EQ(FaviconURL::FAVICON, helper.current_candidate()->icon_type);
// Favicon shouldn't request to download icon.
DownloadHandler* download_handler = helper.download_handler();
@@ -348,14 +348,14 @@
// Simulates update favicon url.
std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(icon_url, FAVICON));
+ urls.push_back(FaviconURL(icon_url, FaviconURL::FAVICON));
DownloadHandler::UpdateFaviconURL(&helper, urls);
// Verify FaviconHelper status
EXPECT_EQ(1U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
ASSERT_EQ(icon_url, helper.current_candidate()->icon_url);
- ASSERT_EQ(FAVICON, helper.current_candidate()->icon_type);
+ ASSERT_EQ(FaviconURL::FAVICON, helper.current_candidate()->icon_type);
// Favicon should request to download icon now.
DownloadHandler* download_handler = helper.download_handler();
@@ -374,7 +374,7 @@
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(icon_url, history_handler->icon_url_);
- EXPECT_EQ(FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::FAVICON, history_handler->icon_type_);
EXPECT_LT(0U, history_handler->image_data_.size());
EXPECT_EQ(page_url, history_handler->page_url_);
@@ -420,14 +420,14 @@
// Simulates update with the different favicon url.
std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(new_icon_url, FAVICON));
+ urls.push_back(FaviconURL(new_icon_url, FaviconURL::FAVICON));
DownloadHandler::UpdateFaviconURL(&helper, urls);
// Verify FaviconHelper status.
EXPECT_EQ(1U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
ASSERT_EQ(new_icon_url, helper.current_candidate()->icon_url);
- ASSERT_EQ(FAVICON, helper.current_candidate()->icon_type);
+ ASSERT_EQ(FaviconURL::FAVICON, helper.current_candidate()->icon_type);
// The favicon status's url should be updated.
ASSERT_EQ(new_icon_url, helper.GetEntry()->favicon().url());
@@ -435,7 +435,7 @@
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(new_icon_url, history_handler->icon_url_);
- EXPECT_EQ(FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::FAVICON, history_handler->icon_type_);
EXPECT_EQ(page_url, history_handler->page_url_);
// Simulate not find icon.
@@ -459,7 +459,7 @@
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(new_icon_url, history_handler->icon_url_);
- EXPECT_EQ(FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::FAVICON, history_handler->icon_type_);
EXPECT_LT(0U, history_handler->image_data_.size());
EXPECT_EQ(page_url, history_handler->page_url_);
@@ -505,14 +505,14 @@
// Simulates update with the different favicon url.
std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(new_icon_url, FAVICON));
+ urls.push_back(FaviconURL(new_icon_url, FaviconURL::FAVICON));
DownloadHandler::UpdateFaviconURL(&helper, urls);
// Verify FaviconHelper status.
EXPECT_EQ(1U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
ASSERT_EQ(new_icon_url, helper.current_candidate()->icon_url);
- ASSERT_EQ(FAVICON, helper.current_candidate()->icon_type);
+ ASSERT_EQ(FaviconURL::FAVICON, helper.current_candidate()->icon_type);
// The favicon status's url should be updated.
ASSERT_EQ(new_icon_url, helper.GetEntry()->favicon().url());
@@ -520,7 +520,7 @@
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(new_icon_url, history_handler->icon_url_);
- EXPECT_EQ(FAVICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::FAVICON, history_handler->icon_type_);
EXPECT_EQ(page_url, history_handler->page_url_);
// Simulate find icon.
@@ -570,9 +570,9 @@
// Simulates update with the different favicon url.
std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(icon_url, TOUCH_PRECOMPOSED_ICON));
- urls.push_back(FaviconURL(new_icon_url, TOUCH_ICON));
- urls.push_back(FaviconURL(new_icon_url, FAVICON));
+ urls.push_back(FaviconURL(icon_url, FaviconURL::TOUCH_PRECOMPOSED_ICON));
+ urls.push_back(FaviconURL(new_icon_url, FaviconURL::TOUCH_ICON));
+ urls.push_back(FaviconURL(new_icon_url, FaviconURL::FAVICON));
DownloadHandler::UpdateFaviconURL(&helper, urls);
@@ -580,13 +580,14 @@
EXPECT_EQ(2U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
ASSERT_EQ(icon_url, helper.current_candidate()->icon_url);
- ASSERT_EQ(TOUCH_PRECOMPOSED_ICON, helper.current_candidate()->icon_type);
+ ASSERT_EQ(FaviconURL::TOUCH_PRECOMPOSED_ICON,
+ helper.current_candidate()->icon_type);
// Favicon should be requested from history.
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(icon_url, history_handler->icon_url_);
- EXPECT_EQ(TOUCH_PRECOMPOSED_ICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::TOUCH_PRECOMPOSED_ICON, history_handler->icon_type_);
EXPECT_EQ(page_url, history_handler->page_url_);
// Simulate not find icon.
@@ -611,13 +612,13 @@
EXPECT_EQ(1U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
EXPECT_EQ(new_icon_url, helper.current_candidate()->icon_url);
- EXPECT_EQ(TOUCH_ICON, helper.current_candidate()->icon_type);
+ EXPECT_EQ(FaviconURL::TOUCH_ICON, helper.current_candidate()->icon_type);
// Favicon should be requested from history.
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(new_icon_url, history_handler->icon_url_);
- EXPECT_EQ(TOUCH_ICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::TOUCH_ICON, history_handler->icon_type_);
EXPECT_EQ(page_url, history_handler->page_url_);
// Reset download handler
@@ -648,7 +649,7 @@
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(new_icon_url, history_handler->icon_url_);
- EXPECT_EQ(TOUCH_ICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::TOUCH_ICON, history_handler->icon_type_);
EXPECT_LT(0U, history_handler->image_data_.size());
EXPECT_EQ(page_url, history_handler->page_url_);
}
@@ -683,9 +684,9 @@
// Simulates update with the different favicon url.
std::vector<FaviconURL> urls;
- urls.push_back(FaviconURL(icon_url, TOUCH_PRECOMPOSED_ICON));
- urls.push_back(FaviconURL(new_icon_url, TOUCH_ICON));
- urls.push_back(FaviconURL(new_icon_url, FAVICON));
+ urls.push_back(FaviconURL(icon_url, FaviconURL::TOUCH_PRECOMPOSED_ICON));
+ urls.push_back(FaviconURL(new_icon_url, FaviconURL::TOUCH_ICON));
+ urls.push_back(FaviconURL(new_icon_url, FaviconURL::FAVICON));
DownloadHandler::UpdateFaviconURL(&helper, urls);
@@ -693,13 +694,14 @@
EXPECT_EQ(2U, helper.urls().size());
ASSERT_TRUE(helper.current_candidate());
ASSERT_EQ(icon_url, helper.current_candidate()->icon_url);
- ASSERT_EQ(TOUCH_PRECOMPOSED_ICON, helper.current_candidate()->icon_type);
+ ASSERT_EQ(FaviconURL::TOUCH_PRECOMPOSED_ICON,
+ helper.current_candidate()->icon_type);
// Favicon should be requested from history.
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(icon_url, history_handler->icon_url_);
- EXPECT_EQ(TOUCH_PRECOMPOSED_ICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::TOUCH_PRECOMPOSED_ICON, history_handler->icon_type_);
EXPECT_EQ(page_url, history_handler->page_url_);
// Simulate not find icon.
@@ -718,17 +720,17 @@
helper.set_history_handler(NULL);
const GURL latest_icon_url("http://www.google.com/latest_favicon");
std::vector<FaviconURL> latest_urls;
- latest_urls.push_back(FaviconURL(latest_icon_url, TOUCH_ICON));
+ latest_urls.push_back(FaviconURL(latest_icon_url, FaviconURL::TOUCH_ICON));
DownloadHandler::UpdateFaviconURL(&helper, latest_urls);
EXPECT_EQ(1U, helper.urls().size());
EXPECT_EQ(latest_icon_url, helper.current_candidate()->icon_url);
- EXPECT_EQ(TOUCH_ICON, helper.current_candidate()->icon_type);
+ EXPECT_EQ(FaviconURL::TOUCH_ICON, helper.current_candidate()->icon_type);
// Whether new icon is requested from history
history_handler = helper.history_handler();
ASSERT_TRUE(history_handler);
EXPECT_EQ(latest_icon_url, history_handler->icon_url_);
- EXPECT_EQ(TOUCH_ICON, history_handler->icon_type_);
+ EXPECT_EQ(FaviconURL::TOUCH_ICON, history_handler->icon_type_);
EXPECT_EQ(page_url, history_handler->page_url_);
// Reset the history_handler to verify whether favicon is request from
« no previous file with comments | « chrome/browser/favicon_helper.cc ('k') | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698