Index: chrome/browser/ui/browser_focus_uitest.cc |
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc |
index 142b522a2f57f1115904b454efc30aaabd8ba406..0cfb2b8f79a61e7cfec5d9ff72fd254bf63744b6 100644 |
--- a/chrome/browser/ui/browser_focus_uitest.cc |
+++ b/chrome/browser/ui/browser_focus_uitest.cc |
@@ -738,4 +738,29 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnNavigate) { |
EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
} |
+// Ensure that crbug.com/567445 does not regress. |
Peter Kasting
2016/03/03 21:02:18
Nit: Explain here what this is testing, e.g. "Ensu
palmer
2016/03/04 22:15:56
Done.
|
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest, AboutBlankNavigationLocationTest) { |
+ ui_test_utils::NavigateToURL(browser(), |
+ embedded_test_server()->GetURL("/title1.html")); |
Peter Kasting
2016/03/03 21:02:18
Nit: Store URL in a temp since you use it twice:
palmer
2016/03/04 22:15:56
Done.
|
+ |
+ const char kSpoofScript[] = |
+ "var w = window.open('about:blank');" |
Peter Kasting
2016/03/03 21:02:18
Nit: Could go on previous line (and next two lines
palmer
2016/03/04 22:15:56
Done.
|
+ "w.opener = null;" |
+ "w.document.location = '%s';"; |
+ |
+ TabStripModel* tab_strip = browser()->tab_strip_model(); |
+ WebContents* web_contents = tab_strip->GetActiveWebContents(); |
+ |
+ ASSERT_TRUE(content::ExecuteScript( |
+ web_contents, |
+ base::StringPrintf( |
+ kSpoofScript, |
+ embedded_test_server()->GetURL("/title2.html").spec().c_str()))); |
+ EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"), |
+ web_contents->GetVisibleURL()); |
+ ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( |
+ browser()->tab_strip_model()->GetActiveWebContents())); |
Peter Kasting
2016/03/03 21:02:18
Is this different than |web_contents|? If so I'd
palmer
2016/03/04 22:15:56
Yes, they are different; it's the newly-opened con
|
+ EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
Charlie Reis
2016/02/25 00:48:40
Sure, these lines look plausible to me, assuming t
palmer
2016/03/04 22:15:56
Acknowledged.
|
+} |
+ |
} // namespace |