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

Unified Diff: chrome/browser/favicon/content_favicon_driver_browsertest.cc

Issue 2950563002: Fix in-document navigations breaking icons from Web Manifests (Closed)
Patch Set: Simplify test. Created 3 years, 6 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 | « no previous file | chrome/test/data/favicon/pushstate_with_manifest.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/content_favicon_driver_browsertest.cc
diff --git a/chrome/browser/favicon/content_favicon_driver_browsertest.cc b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
index 88b785267c9a80cb6675a75ce538fabed09c0ae7..b83079f66d0f4ae4c85d713e68430cc00bd3c1ea 100644
--- a/chrome/browser/favicon/content_favicon_driver_browsertest.cc
+++ b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
@@ -179,7 +179,9 @@ class ContentFaviconDriverTest : public InProcessBrowserTest,
->HasPendingTasksForTest();
}
- favicon_base::FaviconRawBitmapResult GetFaviconForPageURL(const GURL& url) {
+ favicon_base::FaviconRawBitmapResult GetFaviconForPageURL(
+ const GURL& url,
+ favicon_base::IconType icon_type) {
favicon::FaviconService* favicon_service =
FaviconServiceFactory::GetForProfile(
browser()->profile(), ServiceAccessType::EXPLICIT_ACCESS);
@@ -188,7 +190,7 @@ class ContentFaviconDriverTest : public InProcessBrowserTest,
base::CancelableTaskTracker tracker;
base::RunLoop loop;
favicon_service->GetFaviconForPageURL(
- url, favicon_base::FAVICON, /*desired_size_in_dip=*/0,
+ url, icon_type, /*desired_size_in_dip=*/0,
base::Bind(
[](std::vector<favicon_base::FaviconRawBitmapResult>* save_results,
base::RunLoop* loop,
@@ -281,6 +283,9 @@ IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, LoadIconFromWebManifest) {
#if defined(OS_ANDROID) || defined(OS_IOS)
EXPECT_TRUE(delegate->was_requested());
+ EXPECT_NE(
+ nullptr,
+ GetFaviconForPageURL(url, favicon_base::WEB_MANIFEST_ICON).bitmap_data);
#else
EXPECT_FALSE(delegate->was_requested());
#endif
@@ -304,7 +309,8 @@ IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest,
ui_test_utils::BROWSER_TEST_NONE);
waiter.Wait();
}
- ASSERT_NE(nullptr, GetFaviconForPageURL(url).bitmap_data);
+ ASSERT_NE(nullptr,
+ GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data);
ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
@@ -320,5 +326,30 @@ IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest,
waiter.Wait();
}
- EXPECT_NE(nullptr, GetFaviconForPageURL(url).bitmap_data);
+ EXPECT_NE(nullptr,
+ GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data);
}
+
+#if defined(OS_ANDROID) || defined(OS_IOS)
+IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest,
+ LoadIconFromWebManifestDespitePushState) {
+ base::test::ScopedFeatureList override_features;
+ override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest);
+
+ ASSERT_TRUE(embedded_test_server()->Start());
+ GURL url =
+ embedded_test_server()->GetURL("/favicon/pushstate_with_manifest.html");
+ GURL pushstate_url = embedded_test_server()->GetURL(
+ "/favicon/pushstate_with_manifest.html#pushState");
+
+ PendingTaskWaiter waiter(web_contents(), this);
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(), url, WindowOpenDisposition::CURRENT_TAB,
+ ui_test_utils::BROWSER_TEST_NONE);
pkotwicz 2017/06/21 18:48:34 You should probably wait till the JavaScript has e
+ waiter.Wait();
+
+ EXPECT_NE(nullptr,
+ GetFaviconForPageURL(pushstate_url, favicon_base::WEB_MANIFEST_ICON)
+ .bitmap_data);
+}
+#endif
« no previous file with comments | « no previous file | chrome/test/data/favicon/pushstate_with_manifest.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698