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

Side by Side Diff: a.c

Issue 2696423002: FaviconHandlerTest dream
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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 void RunAllPending(TestFaviconService* favicon_service, TestWebContents* web_con tents) {
2 while (favicon_service->HasPending() || web_contents->HasPending()) {
3 favicon_service->RunAllPending();
4 web_contents->RunAllPending();
5 }
6 }
7
8 void OnUpdateFaviconUrl(FaviconHandler* favicon_handler, const GURL& page_url, c onst GURL& icon_url) {
9 std::vector<FaviconURL> urls;
10 urls.push_back(
11 FaviconURL(icon_url, favicon_base::FAVICON, std::vector<gfx::Size>()));
12 handler->OnUpdateFaviconURL(page_url, urls);
13 }
14
15 TEST_F(FaviconHandlerTest, FaviconInHistoryInvalid) {
16 const GURL page_url("http://www.google.com");
17 const GURL icon_url("http://www.google.com/favicon");
18
19 TestFaviconService service;
20 service.Store(page_url, Icon(icon_url, gfx::kFaviconSize, new base::RefCounted Bytes()));
21 TestWebContents web_contents = GetTestWebContents();
22 web_contents->SetImage(icon_url, CreateSolidColorBitmap(SK_ColorBLUE));
23
24 FaviconHandler handler;
25 handler.FetchFavicon(page_url);
26 OnUpdateFaviconURL(&handler, page_url, icon_url);
27
28 RunAllPending(favicon_service, web_contents);
29
30 std::vector<Icon> stored_icons = handler.stored_icons();
31 ASSERT_EQ(1u, stored_icons.size());
32 EXPECT_EQ(icon_url, stored_icons[0].icon_url);
33 EXPECT_LT(0u, stored_icons[0].data.size());
34
35 // Verify NavigationEntry.
36 EXPECT_EQ(1u, driver.num_notifications());
37 EXPECT_EQ(icon_url, driver.icon_url());
38 EXPECT_FALSE(driver.image().IsEmpty());
39 EXPECT_EQ(gfx::kFaviconSize, driver.image().Width());
40 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698