diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 02:28:51 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 02:28:51 +0000 |
commit | 55c8e2eaaf360fb9b5ff982ac1590296ba1bd3e7 (patch) | |
tree | 9cadd3347fbe213949799964ee2344f863e8ba8f | |
parent | 6ccdfd6a972a621805ef9978e611ade6a658a539 (diff) | |
download | chromium_src-55c8e2eaaf360fb9b5ff982ac1590296ba1bd3e7.zip chromium_src-55c8e2eaaf360fb9b5ff982ac1590296ba1bd3e7.tar.gz chromium_src-55c8e2eaaf360fb9b5ff982ac1590296ba1bd3e7.tar.bz2 |
Reland 90035 - Deflakify Prerender Favicon Test by removing timer and using
an observer instead.
BUG=85729
Review URL: http://codereview.chromium.org/7218024
TBR=tburkard@chromium.org
Review URL: http://codereview.chromium.org/7198012
TBR=rvargas@google.com
Review URL: http://codereview.chromium.org/7239008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90156 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/favicon/favicon_tab_helper.cc | 5 | ||||
-rw-r--r-- | chrome/browser/prerender/prerender_browsertest.cc | 18 | ||||
-rw-r--r-- | content/common/notification_type.h | 4 |
3 files changed, 15 insertions, 12 deletions
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc index 0200e47..426d3e7 100644 --- a/chrome/browser/favicon/favicon_tab_helper.cc +++ b/chrome/browser/favicon/favicon_tab_helper.cc @@ -15,6 +15,7 @@ #include "content/browser/tab_contents/tab_contents_delegate.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/webui/web_ui.h" +#include "content/common/notification_service.h" #include "ui/gfx/codec/png_codec.h" #include "ui/gfx/image/image.h" @@ -135,6 +136,10 @@ void FaviconTabHelper::StartDownload(int id, const GURL& url, int image_size) { } void FaviconTabHelper::NotifyFaviconUpdated() { + NotificationService::current()->Notify( + NotificationType::FAVICON_UPDATED, + Source<TabContents>(tab_contents()), + NotificationService::NoDetails()); tab_contents()->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); } diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc index f1dec03..1b598c2 100644 --- a/chrome/browser/prerender/prerender_browsertest.cc +++ b/chrome/browser/prerender/prerender_browsertest.cc @@ -1385,24 +1385,18 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderLocalStorageWrite) { } // Checks that the favicon is properly loaded on prerender. -// FLAKY: http://crbug.com/85729 -IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, FLAKY_PrerenderFavicon) { +IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderFavicon) { PrerenderTestURL("files/prerender/prerender_favicon.html", FINAL_STATUS_USED, 1); TestPrerenderContents* prerender_contents = GetPrerenderContents(); ASSERT_TRUE(prerender_contents != NULL); - prerender_contents->set_quit_message_loop_on_destruction(false); - // The Favicon should show within two seconds of navigating to the page, - // otherwise something is wrong. - MessageLoopForUI::current()->PostDelayedTask( - FROM_HERE, - new MessageLoop::QuitTask(), - TestTimeouts::action_timeout_ms()); + ui_test_utils::WindowedNotificationObserver favicon_update_watcher( + NotificationType::FAVICON_UPDATED, + Source<TabContents>(prerender_contents->prerender_contents()-> + tab_contents())); NavigateToDestURL(); - ASSERT_TRUE(TabContentsWrapper::GetCurrentWrapperForContents( - browser()->GetSelectedTabContents())->favicon_tab_helper() - ->FaviconIsValid()); + favicon_update_watcher.Wait(); } // Checks that when a prerendered page is swapped in to a referring page, the diff --git a/content/common/notification_type.h b/content/common/notification_type.h index f92998a..957da92 100644 --- a/content/common/notification_type.h +++ b/content/common/notification_type.h @@ -677,6 +677,10 @@ class NotificationType { // history_notifications.h). FAVICON_CHANGED, + // Sent by FaviconTabHelper when a tab's favicon has been successfully + // updated. + FAVICON_UPDATED, + // Sent after an incognito profile has been created. The details are none // and the source is the new profile. OTR_PROFILE_CREATED, |