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

Unified Diff: chrome/browser/ui/views/find_bar_host_interactive_uitest.cc

Issue 8800011: Use Textfield's view ID instead of Location bar's view id (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years 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 | « chrome/browser/ui/view_ids.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
index c37ffe7bd7b448fc1dc09c0426a2bf0f3e3efcf0..ff295ffa6181c6449560f02c607918e7212ed5fa 100644
--- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
+++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc
@@ -38,7 +38,13 @@ void Checkpoint(const char* message, const base::TimeTicks& start_time) {
class FindInPageTest : public InProcessBrowserTest {
public:
- FindInPageTest() {
+ FindInPageTest() :
+#if defined(USE_AURA)
+ location_bar_focus_view_id_(VIEW_ID_OMNIBOX)
+#else
+ location_bar_focus_view_id_(VIEW_ID_LOCATION_BAR)
+#endif
+ {
set_show_window(true);
FindBarHost::disable_animations_during_testing_ = true;
}
@@ -54,6 +60,11 @@ class FindInPageTest : public InProcessBrowserTest {
browser()->GetFindBarController()->find_bar()->GetFindBarTesting();
return find_bar->GetFindSelectedText();
}
+
+ ViewID location_bar_focus_view_id_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FindInPageTest);
};
} // namespace
@@ -89,10 +100,9 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, MAYBE_CrashEscHandlers) {
// Click on the location bar so that Find box loses focus.
ASSERT_NO_FATAL_FAILURE(ui_test_utils::ClickOnView(browser(),
VIEW_ID_LOCATION_BAR));
-#if defined(TOOLKIT_VIEWS) || defined(OS_WIN)
// Check the location bar is focused.
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
-#endif
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
// This used to crash until bug 1303709 was fixed.
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
@@ -108,14 +118,16 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) {
// Focus the location bar, open and close the find-in-page, focus should
// return to the location bar.
browser()->FocusLocationBar();
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
// Ensure the creation of the find bar controller.
browser()->GetFindBarController()->Show();
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
browser()->GetFindBarController()->EndFindSession(
FindBarController::kKeepSelection);
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
// Focus the location bar, find something on the page, close the find box,
// focus should go to the page.
@@ -134,13 +146,15 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestore) {
// the location bar (same as before, just checking that http://crbug.com/23599
// is fixed).
browser()->FocusLocationBar();
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
browser()->GetFindBarController()->Show();
EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
browser()->GetFindBarController()->EndFindSession(
FindBarController::kKeepSelection);
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
}
IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestoreOnTabSwitch) {
@@ -181,7 +195,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestoreOnTabSwitch) {
// Set focus away from the Find bar (to the Location bar).
browser()->FocusLocationBar();
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
// Select tab A. Find bar should get focus.
browser()->ActivateTabAt(0, true);
@@ -191,7 +206,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, FocusRestoreOnTabSwitch) {
// Select tab B. Location bar should get focus.
browser()->ActivateTabAt(1, true);
- EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_LOCATION_BAR));
+ EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(),
+ location_bar_focus_view_id_));
}
// This tests that whenever you clear values from the Find box and close it that
« no previous file with comments | « chrome/browser/ui/view_ids.h ('k') | chrome/browser/ui/views/location_bar/location_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698