Chromium Code Reviews| Index: content/browser/site_per_process_browsertest.cc |
| diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc |
| index 4f2eacedf5199d3f835a4de3016578cbabe52404..91860bedf30ad18dac921343c121906d1b5ffbf6 100644 |
| --- a/content/browser/site_per_process_browsertest.cc |
| +++ b/content/browser/site_per_process_browsertest.cc |
| @@ -7157,15 +7157,29 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| load_observer.Wait(); |
| } |
| - // The blocked frame should stay at the old location. |
| - EXPECT_EQ(old_subframe_url, root->child_at(0)->current_url()); |
| + if (IsBrowserSideNavigationEnabled()) { |
|
alexmos
2017/02/10 22:59:53
I'm not too thrilled that there will be a behavior
|
| + // The blocked frame should go to an error page. Hence its url is the |
| + // blocked page url. |
|
alexmos
2017/02/10 22:59:53
This isn't very intuitive, so perhaps explain why
arthursonzogni
2017/02/13 16:33:20
Done.
|
| + EXPECT_EQ(blocked_url, root->child_at(0)->current_url()); |
| - // The blocked frame should keep the old title. |
| - std::string frame_title; |
| - EXPECT_TRUE(ExecuteScriptAndExtractString( |
| - root->child_at(0), "domAutomationController.send(document.title)", |
| - &frame_title)); |
| - EXPECT_EQ("Title Of Awesomeness", frame_title); |
| + // The page should get the title of an error page (i.e "") and not the |
| + // title of the blocked page. |
| + std::string frame_title; |
| + EXPECT_TRUE(ExecuteScriptAndExtractString( |
| + root->child_at(0), "domAutomationController.send(document.title)", |
| + &frame_title)); |
| + EXPECT_EQ("", frame_title); |
|
alexmos
2017/02/10 22:59:53
I'd also check RFHI::last_successful_url() to make
arthursonzogni
2017/02/13 16:33:20
RFHI::last_successful_url() returns the empty url
alexmos
2017/02/14 06:57:19
Ah, got it, thanks. That's actually really great;
|
| + } else { |
| + // The blocked frame should stay at the old location. |
| + EXPECT_EQ(old_subframe_url, root->child_at(0)->current_url()); |
| + |
| + // The blocked frame should keep the old title. |
| + std::string frame_title; |
| + EXPECT_TRUE(ExecuteScriptAndExtractString( |
| + root->child_at(0), "domAutomationController.send(document.title)", |
| + &frame_title)); |
| + EXPECT_EQ("Title Of Awesomeness", frame_title); |
| + } |
| // Navigate to a URL without CSP. |
| EXPECT_TRUE(NavigateToURL( |
| @@ -7232,15 +7246,29 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| load_observer2.Wait(); |
| } |
| - // The blocked frame should stay at the old location. |
| - EXPECT_EQ(old_subframe_url, root->child_at(0)->current_url()); |
| + if (IsBrowserSideNavigationEnabled()) { |
| + // The blocked frame should go an error page. Hence its url is the |
| + // blocked page url. |
| + EXPECT_EQ(blocked_url, root->child_at(0)->current_url()); |
| - // The blocked frame should keep the old title. |
| - std::string frame_title; |
| - EXPECT_TRUE(ExecuteScriptAndExtractString( |
| - root->child_at(0), "domAutomationController.send(document.title)", |
| - &frame_title)); |
| - EXPECT_EQ("Title Of Awesomeness", frame_title); |
| + // The page should get the title of an error page (i.e "") and not the |
| + // title of the blocked page. |
| + std::string frame_title; |
| + EXPECT_TRUE(ExecuteScriptAndExtractString( |
| + root->child_at(0), "domAutomationController.send(document.title)", |
| + &frame_title)); |
| + EXPECT_EQ("", frame_title); |
| + } else { |
| + // The blocked frame should stay at the old location. |
| + EXPECT_EQ(old_subframe_url, root->child_at(0)->current_url()); |
| + |
| + // The blocked frame should keep the old title. |
| + std::string frame_title; |
| + EXPECT_TRUE(ExecuteScriptAndExtractString( |
| + root->child_at(0), "domAutomationController.send(document.title)", |
| + &frame_title)); |
| + EXPECT_EQ("Title Of Awesomeness", frame_title); |
| + } |
| } |
| // Test that a cross-origin frame's navigation can be blocked by CSP frame-src. |
| @@ -7301,15 +7329,29 @@ IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, |
| load_observer2.Wait(); |
| } |
| - // The blocked frame should stay at the old location. |
| - EXPECT_EQ(old_subframe_url, navigating_frame->current_url()); |
| + if (IsBrowserSideNavigationEnabled()) { |
| + // The blocked frame should go an error page. Hence its url is the |
| + // blocked page url. |
| + EXPECT_EQ(blocked_url, navigating_frame->current_url()); |
| - // The blocked frame should keep the old title. |
| - std::string frame_title; |
| - EXPECT_TRUE(ExecuteScriptAndExtractString( |
| - navigating_frame, "domAutomationController.send(document.title)", |
| - &frame_title)); |
| - EXPECT_EQ("Title Of Awesomeness", frame_title); |
| + // The page should get the title of an error page (i.e "") and not the |
| + // title of the blocked page. |
| + std::string frame_title; |
| + EXPECT_TRUE(ExecuteScriptAndExtractString( |
| + navigating_frame, "domAutomationController.send(document.title)", |
| + &frame_title)); |
| + EXPECT_EQ("", frame_title); |
| + } else { |
| + // The blocked frame should stay at the old location. |
| + EXPECT_EQ(old_subframe_url, navigating_frame->current_url()); |
| + |
| + // The blocked frame should keep the old title. |
| + std::string frame_title; |
| + EXPECT_TRUE(ExecuteScriptAndExtractString( |
| + navigating_frame, "domAutomationController.send(document.title)", |
| + &frame_title)); |
| + EXPECT_EQ("Title Of Awesomeness", frame_title); |
| + } |
| // Navigate the subframe to a URL without CSP. |
| NavigateFrameToURL(srcdoc_frame, |