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

Unified Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 984063003: Add more tests for manual and auto subframe navigation classifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: matching test name to enum name Created 5 years, 9 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl_browsertest.cc
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index 9024ff66517a200edaf5ae982bfd46fd18342fac..adeefa1510b8b5918cc1405f10e7f3ba0e5ef971 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -282,7 +282,7 @@ struct LoadCommittedCapturer : public WebContentsObserver {
// for subframe navigations. TODO(avi): It's rather bogus that the same info is
// in two different enums; http://crbug.com/453555.
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
- ManualAndAutoSubframeNavigationClassification) {
+ NavigationTypeClassification_NewAndAutoSubframe) {
GURL main_url(embedded_test_server()->GetURL(
"/navigation_controller/page_with_iframe.html"));
NavigateToURL(shell(), main_url);
@@ -365,6 +365,32 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
}
{
+ // Use history.pushState(); expect a manual subframe transition.
+ FrameNavigateParamsCapturer capturer(root->child_at(0));
+ std::string script =
+ "history.pushState({}, 'page 1', 'simple_page_1.html')";
+ EXPECT_TRUE(content::ExecuteScript(root->child_at(0)->current_frame_host(),
+ script));
+ capturer.Wait();
+ EXPECT_EQ(ui::PAGE_TRANSITION_MANUAL_SUBFRAME,
+ capturer.params().transition);
+ EXPECT_EQ(NAVIGATION_TYPE_NEW_SUBFRAME, capturer.details().type);
+ }
+
+ {
+ // Use history.replaceState(); expect an auto subframe transition.
+ // (Replacements aren't "navigation" so we only see the frame load
+ // committing.)
+ LoadCommittedCapturer capturer(root->child_at(0));
+ std::string script =
+ "history.replaceState({}, 'page 2', 'simple_page_2.html')";
+ EXPECT_TRUE(content::ExecuteScript(root->child_at(0)->current_frame_host(),
+ script));
+ capturer.Wait();
+ EXPECT_EQ(ui::PAGE_TRANSITION_AUTO_SUBFRAME, capturer.transition_type());
Charlie Reis 2015/03/06 22:06:30 Is there anything we can check here and in locatio
Avi (use Gerrit) 2015/03/06 22:19:02 I was kinda assuming things actually worked here,
+ }
+
+ {
// Reload the subframe; expect an auto subframe transition. (Reloads aren't
// "navigation" so we only see the frame load committing.)
LoadCommittedCapturer capturer(root->child_at(0));
« 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