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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 945
946 // The tab contents should have the focus in the second tab. 946 // The tab contents should have the focus in the second tab.
947 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER)); 947 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_TAB_CONTAINER));
948 948
949 // Go back to the first tab. The focus should not be in the omnibox. 949 // Go back to the first tab. The focus should not be in the omnibox.
950 chrome::SelectPreviousTab(browser()); 950 chrome::SelectPreviousTab(browser());
951 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); 951 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
952 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); 952 EXPECT_FALSE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX));
953 } 953 }
954 954
955 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnNavigate) {
956 // Load the NTP.
957 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL));
958 EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
959
960 // Navigate to another page.
961 const base::FilePath::CharType* kEmptyFile = FILE_PATH_LITERAL("empty.html");
962 GURL file_url(ui_test_utils::GetTestUrl(base::FilePath(
963 base::FilePath::kCurrentDirectory), base::FilePath(kEmptyFile)));
964 ui_test_utils::NavigateToURL(browser(), file_url);
965
966 ClickOnView(VIEW_ID_TAB_CONTAINER);
967
968 // Navigate back. Should focus the location bar.
969 {
970 content::WindowedNotificationObserver back_nav_observer(
971 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
972 content::NotificationService::AllSources());
973 chrome::GoBack(browser(), CURRENT_TAB);
974 back_nav_observer.Wait();
975 }
976
977 EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
978
979 // Navigate forward. Shouldn't focus the location bar.
980 ClickOnView(VIEW_ID_TAB_CONTAINER);
981 {
982 content::WindowedNotificationObserver forward_nav_observer(
983 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
984 content::NotificationService::AllSources());
985 chrome::GoForward(browser(), CURRENT_TAB);
986 forward_nav_observer.Wait();
987 }
988
989 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX));
990 }
991
992
955 } // namespace 993 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698