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

Side by Side Diff: chrome/browser/favicon/content_favicon_driver_browsertest.cc

Issue 2949023002: [WIP] Fix history.replaceState() not propagating back favicons (Closed)
Patch Set: Focus on history.replaceState() Created 3 years, 5 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 | chrome/browser/history/history_tab_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/favicon/content/content_favicon_driver.h" 5 #include "components/favicon/content/content_favicon_driver.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 ui_test_utils::BROWSER_TEST_NONE); 436 ui_test_utils::BROWSER_TEST_NONE);
437 waiter.Wait(); 437 waiter.Wait();
438 438
439 EXPECT_NE(nullptr, 439 EXPECT_NE(nullptr,
440 GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data); 440 GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data);
441 EXPECT_NE( 441 EXPECT_NE(
442 nullptr, 442 nullptr,
443 GetFaviconForPageURL(landing_url, favicon_base::FAVICON).bitmap_data); 443 GetFaviconForPageURL(landing_url, favicon_base::FAVICON).bitmap_data);
444 } 444 }
445 445
446 // Test that a page which uses JavaScript's history.replaceState() to update
447 // the URL in the omnibox (and history) gets associated favicons.
448 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest,
449 AssociateIconWithInitialPageIconDespiteReplaceState) {
450 ASSERT_TRUE(embedded_test_server()->Start());
451 GURL url =
452 embedded_test_server()->GetURL("/favicon/replacestate_with_favicon.html");
453 GURL replacestate_url = embedded_test_server()->GetURL(
454 "/favicon/replacestate_with_favicon_replaced.html");
455
456 PendingTaskWaiter waiter(web_contents(), replacestate_url);
457 ui_test_utils::NavigateToURLWithDisposition(
458 browser(), url, WindowOpenDisposition::CURRENT_TAB,
459 ui_test_utils::BROWSER_TEST_NONE);
460 waiter.Wait();
461
462 EXPECT_NE(nullptr,
463 GetFaviconForPageURL(url, favicon_base::FAVICON).bitmap_data);
464 EXPECT_NE(nullptr,
465 GetFaviconForPageURL(replacestate_url, favicon_base::FAVICON)
466 .bitmap_data);
467 }
468
446 #if defined(OS_ANDROID) 469 #if defined(OS_ANDROID)
447 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, 470 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest,
448 LoadIconFromWebManifestDespitePushState) { 471 LoadIconFromWebManifestDespitePushState) {
449 base::test::ScopedFeatureList override_features; 472 base::test::ScopedFeatureList override_features;
450 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest); 473 override_features.InitAndEnableFeature(favicon::kFaviconsFromWebManifest);
451 474
452 ASSERT_TRUE(embedded_test_server()->Start()); 475 ASSERT_TRUE(embedded_test_server()->Start());
453 GURL url = 476 GURL url =
454 embedded_test_server()->GetURL("/favicon/pushstate_with_manifest.html"); 477 embedded_test_server()->GetURL("/favicon/pushstate_with_manifest.html");
455 GURL pushstate_url = embedded_test_server()->GetURL( 478 GURL pushstate_url = embedded_test_server()->GetURL(
456 "/favicon/pushstate_with_manifest.html#pushState"); 479 "/favicon/pushstate_with_manifest.html#pushState");
457 480
458 PendingTaskWaiter waiter(web_contents(), /*required_url=*/pushstate_url); 481 PendingTaskWaiter waiter(web_contents(), /*required_url=*/pushstate_url);
459 ui_test_utils::NavigateToURLWithDisposition( 482 ui_test_utils::NavigateToURLWithDisposition(
460 browser(), url, WindowOpenDisposition::CURRENT_TAB, 483 browser(), url, WindowOpenDisposition::CURRENT_TAB,
461 ui_test_utils::BROWSER_TEST_NONE); 484 ui_test_utils::BROWSER_TEST_NONE);
462 waiter.Wait(); 485 waiter.Wait();
463 486
464 EXPECT_NE(nullptr, 487 EXPECT_NE(nullptr,
465 GetFaviconForPageURL(pushstate_url, favicon_base::WEB_MANIFEST_ICON) 488 GetFaviconForPageURL(pushstate_url, favicon_base::WEB_MANIFEST_ICON)
466 .bitmap_data); 489 .bitmap_data);
467 } 490 }
468 #endif 491 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/history_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698