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

Unified Diff: chrome/browser/ui/browser_focus_uitest.cc

Issue 1678233003: Don't focus the location bar in a phishy situation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it a uitest. Created 4 years, 10 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 | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..50d56213e7d2a1780d321f793b305d75af5b0845 100644
--- a/chrome/browser/ui/browser_focus_uitest.cc
+++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -738,4 +738,28 @@ IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnNavigate) {
EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX));
}
+// Ensure that crbug.com/567445 does not regress.
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest, AboutBlankNavigationLocationTest) {
+ ui_test_utils::NavigateToURL(browser(),
+ embedded_test_server()->GetURL("/title1.html"));
+
+ const char kSpoofScript[] =
+ "var w = window.open('about:blank');"
+ "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_FALSE(web_contents->GetController().GetPendingEntry());
Charlie Reis 2016/02/12 23:43:47 I don't think you don't need this line. Technical
palmer 2016/02/23 00:37:59 Done.
+ EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"),
+ web_contents->GetVisibleURL());
Charlie Reis 2016/02/12 23:43:47 Hmm, this isn't the WebContents where the spoof ha
palmer 2016/02/23 00:37:59 Following the example of other code in this file,
+ EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX));
Charlie Reis 2016/02/12 23:43:47 Which window is this checking? Is the test openin
palmer 2016/02/23 00:37:59 I think the core problem is that the Omnibox is fo
+}
+
} // namespace
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698