Index: a.c |
diff --git a/a.c b/a.c |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d46f186f638a9cd152fa885d11965e6855434894 |
--- /dev/null |
+++ b/a.c |
@@ -0,0 +1,40 @@ |
+void RunAllPending(TestFaviconService* favicon_service, TestWebContents* web_contents) { |
+ while (favicon_service->HasPending() || web_contents->HasPending()) { |
+ favicon_service->RunAllPending(); |
+ web_contents->RunAllPending(); |
+ } |
+} |
+ |
+void OnUpdateFaviconUrl(FaviconHandler* favicon_handler, const GURL& page_url, const GURL& icon_url) { |
+ std::vector<FaviconURL> urls; |
+ urls.push_back( |
+ FaviconURL(icon_url, favicon_base::FAVICON, std::vector<gfx::Size>())); |
+ handler->OnUpdateFaviconURL(page_url, urls); |
+} |
+ |
+TEST_F(FaviconHandlerTest, FaviconInHistoryInvalid) { |
+ const GURL page_url("http://www.google.com"); |
+ const GURL icon_url("http://www.google.com/favicon"); |
+ |
+ TestFaviconService service; |
+ service.Store(page_url, Icon(icon_url, gfx::kFaviconSize, new base::RefCountedBytes())); |
+ TestWebContents web_contents = GetTestWebContents(); |
+ web_contents->SetImage(icon_url, CreateSolidColorBitmap(SK_ColorBLUE)); |
+ |
+ FaviconHandler handler; |
+ handler.FetchFavicon(page_url); |
+ OnUpdateFaviconURL(&handler, page_url, icon_url); |
+ |
+ RunAllPending(favicon_service, web_contents); |
+ |
+ std::vector<Icon> stored_icons = handler.stored_icons(); |
+ ASSERT_EQ(1u, stored_icons.size()); |
+ EXPECT_EQ(icon_url, stored_icons[0].icon_url); |
+ EXPECT_LT(0u, stored_icons[0].data.size()); |
+ |
+ // Verify NavigationEntry. |
+ EXPECT_EQ(1u, driver.num_notifications()); |
+ EXPECT_EQ(icon_url, driver.icon_url()); |
+ EXPECT_FALSE(driver.image().IsEmpty()); |
+ EXPECT_EQ(gfx::kFaviconSize, driver.image().Width()); |
+} |