Chromium Code Reviews| Index: chrome/browser/chrome_navigation_browsertest.cc |
| diff --git a/chrome/browser/chrome_navigation_browsertest.cc b/chrome/browser/chrome_navigation_browsertest.cc |
| index f48e44ee4d610624609e0d7e12a90746ce396cea..e192e2bd03afd36b26ad0d8bbc094db8345fbca7 100644 |
| --- a/chrome/browser/chrome_navigation_browsertest.cc |
| +++ b/chrome/browser/chrome_navigation_browsertest.cc |
| @@ -189,11 +189,14 @@ IN_PROC_BROWSER_TEST_F(ChromeNavigationBrowserTest, TestViewFrameSource) { |
| new_web_contents->GetTitle()); |
| } |
| +class CtrlClickShouldEndUpInNewProcessTest |
| + : public ChromeNavigationBrowserTest, |
| + public ::testing::WithParamInterface<const char*> {}; |
|
Charlie Reis
2017/04/14 22:39:28
Personally I find parameterized tests really confu
Łukasz Anforowicz
2017/04/20 01:15:13
I've switched to separate tests that call to a sha
|
| + |
| // Verify that ctrl-click results 1) open up in a new renderer process |
| // (https://crbug.com/23815) and 2) are in a new browsing instance (e.g. |
| // cannot find the opener's window by name - https://crbug.com/658386). |
| -IN_PROC_BROWSER_TEST_F(ChromeNavigationBrowserTest, |
| - CtrlClickShouldEndUpInNewProcess) { |
| +IN_PROC_BROWSER_TEST_P(CtrlClickShouldEndUpInNewProcessTest, Test) { |
| // Navigate to the test page. |
| GURL main_url(embedded_test_server()->GetURL( |
| "/frame_tree/anchor_to_same_site_location.html")); |
| @@ -210,12 +213,15 @@ IN_PROC_BROWSER_TEST_F(ChromeNavigationBrowserTest, |
| { |
| content::WebContentsAddedObserver new_tab_observer; |
| #if defined(OS_MACOSX) |
| - std::string new_tab_click_script = |
| - "simulateClick(\"test-anchor-no-target\", { metaKey: true });"; |
| + const char* new_tab_click_script_template = |
| + "simulateClick(\"%s\", { metaKey: true });"; |
| #else |
| - std::string new_tab_click_script = |
| - "simulateClick(\"test-anchor-no-target\", { ctrlKey: true });"; |
| + const char* new_tab_click_script_template = |
| + "simulateClick(\"%s\", { ctrlKey: true });"; |
| #endif |
| + const char* name_of_anchor_to_click = GetParam(); |
| + std::string new_tab_click_script = base::StringPrintf( |
| + new_tab_click_script_template, name_of_anchor_to_click); |
| EXPECT_TRUE(ExecuteScript(main_contents, new_tab_click_script)); |
| // Wait for a new tab to appear (the whole point of this test). |
| @@ -274,6 +280,16 @@ IN_PROC_BROWSER_TEST_F(ChromeNavigationBrowserTest, |
| } |
| } |
| +INSTANTIATE_TEST_CASE_P(NoTarget, |
| + CtrlClickShouldEndUpInNewProcessTest, |
| + ::testing::Values("test-anchor-no-target")); |
| +INSTANTIATE_TEST_CASE_P(BlankTarget, |
| + CtrlClickShouldEndUpInNewProcessTest, |
| + ::testing::Values("test-anchor-with-blank-target")); |
| +INSTANTIATE_TEST_CASE_P(SubframeTarget, |
| + CtrlClickShouldEndUpInNewProcessTest, |
| + ::testing::Values("test-anchor-with-subframe-target")); |
| + |
| class ChromeNavigationPortMappedBrowserTest : public InProcessBrowserTest { |
| public: |
| ChromeNavigationPortMappedBrowserTest() {} |