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

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

Issue 14080004: Remove some chrome-specific methods from content::WebUI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: self nits Created 7 years, 8 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
Index: chrome/browser/ui/browser_focus_uitest.cc
===================================================================
--- chrome/browser/ui/browser_focus_uitest.cc (revision 193436)
+++ chrome/browser/ui/browser_focus_uitest.cc (working copy)
@@ -952,4 +952,42 @@
EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
}
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnNavigate) {
+ // Load the NTP.
+ ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
+ EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
+
+ // Navigate to another page.
+ const base::FilePath::CharType* kEmptyFile = FILE_PATH_LITERAL("empty.html");
+ GURL file_url(ui_test_utils::GetTestUrl(base::FilePath(
+ base::FilePath::kCurrentDirectory), base::FilePath(kEmptyFile)));
+ ui_test_utils::NavigateToURL(browser(), file_url);
+
+ ClickOnView(VIEW_ID_TAB_CONTAINER);
+
+ // Navigate back. Should focus the location bar.
+ {
+ content::WindowedNotificationObserver back_nav_observer(
+ content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::NotificationService::AllSources());
+ chrome::GoBack(browser(), CURRENT_TAB);
+ back_nav_observer.Wait();
+ }
+
+ EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
+
+ // Navigate forward. Shouldn't focus the location bar.
+ ClickOnView(VIEW_ID_TAB_CONTAINER);
+ {
+ content::WindowedNotificationObserver forward_nav_observer(
+ content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::NotificationService::AllSources());
+ chrome::GoForward(browser(), CURRENT_TAB);
+ forward_nav_observer.Wait();
+ }
+
+ EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX));
+}
+
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698