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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 content::WindowedNotificationObserver forward_nav_observer( 731 content::WindowedNotificationObserver forward_nav_observer(
732 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 732 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
733 content::NotificationService::AllSources()); 733 content::NotificationService::AllSources());
734 chrome::GoForward(browser(), CURRENT_TAB); 734 chrome::GoForward(browser(), CURRENT_TAB);
735 forward_nav_observer.Wait(); 735 forward_nav_observer.Wait();
736 } 736 }
737 737
738 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); 738 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX));
739 } 739 }
740 740
741 // Ensure that crbug.com/567445 does not regress.
742 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, AboutBlankNavigationLocationTest) {
743 ui_test_utils::NavigateToURL(browser(),
744 embedded_test_server()->GetURL("/title1.html"));
745
746 const char kSpoofScript[] =
747 "var w = window.open('about:blank');"
748 "w.opener = null;"
749 "w.document.location = '%s';";
750
751 TabStripModel* tab_strip = browser()->tab_strip_model();
752 WebContents* web_contents = tab_strip->GetActiveWebContents();
753
754 ASSERT_TRUE(content::ExecuteScript(
755 web_contents,
756 base::StringPrintf(
757 kSpoofScript,
758 embedded_test_server()->GetURL("/title2.html").spec().c_str())));
759 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.
760 EXPECT_EQ(embedded_test_server()->GetURL("/title1.html"),
761 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,
762 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
763 }
764
741 } // namespace 765 } // namespace
OLDNEW
« 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