OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
6 | 6 |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/omnibox/location_bar.h" | 10 #include "chrome/browser/ui/omnibox/location_bar.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::DOWN)); | 60 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::DOWN)); |
61 | 61 |
62 if (press_location != release_location) | 62 if (press_location != release_location) |
63 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(release_location)); | 63 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(release_location)); |
64 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::UP)); | 64 ASSERT_TRUE(ui_test_utils::SendMouseEventsSync(button, ui_controls::UP)); |
65 } | 65 } |
66 | 66 |
67 #if defined(USE_AURA) | 67 #if defined(USE_AURA) |
68 // Tap the center of the browser window. | 68 // Tap the center of the browser window. |
69 void TapBrowserWindowCenter() { | 69 void TapBrowserWindowCenter() { |
70 aura::WindowTreeHostDelegate* rwhd = | 70 aura::RootWindowHostDelegate* rwhd = |
71 browser()->window()->GetNativeWindow()->GetRootWindow()-> | 71 browser()->window()->GetNativeWindow()->GetRootWindow()-> |
72 GetDispatcher()->AsWindowTreeHostDelegate(); | 72 GetDispatcher()->AsRootWindowHostDelegate(); |
73 | 73 |
74 gfx::Point center = BrowserView::GetBrowserViewForBrowser( | 74 gfx::Point center = BrowserView::GetBrowserViewForBrowser( |
75 browser())->GetBoundsInScreen().CenterPoint(); | 75 browser())->GetBoundsInScreen().CenterPoint(); |
76 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center, | 76 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, center, |
77 5, base::TimeDelta::FromMilliseconds(0)); | 77 5, base::TimeDelta::FromMilliseconds(0)); |
78 rwhd->OnHostTouchEvent(&press); | 78 rwhd->OnHostTouchEvent(&press); |
79 | 79 |
80 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center, | 80 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, center, |
81 5, base::TimeDelta::FromMilliseconds(50)); | 81 5, base::TimeDelta::FromMilliseconds(50)); |
82 rwhd->OnHostTouchEvent(&release); | 82 rwhd->OnHostTouchEvent(&release); |
83 } | 83 } |
84 | 84 |
85 // Touch down and release at the specified locations. | 85 // Touch down and release at the specified locations. |
86 void Tap(const gfx::Point& press_location, | 86 void Tap(const gfx::Point& press_location, |
87 const gfx::Point& release_location) { | 87 const gfx::Point& release_location) { |
88 aura::WindowTreeHostDelegate* rwhd = | 88 aura::RootWindowHostDelegate* rwhd = |
89 browser()->window()->GetNativeWindow()->GetRootWindow()-> | 89 browser()->window()->GetNativeWindow()->GetRootWindow()-> |
90 GetDispatcher()->AsWindowTreeHostDelegate(); | 90 GetDispatcher()->AsRootWindowHostDelegate(); |
91 | 91 |
92 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, press_location, | 92 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, press_location, |
93 5, base::TimeDelta::FromMilliseconds(0)); | 93 5, base::TimeDelta::FromMilliseconds(0)); |
94 rwhd->OnHostTouchEvent(&press); | 94 rwhd->OnHostTouchEvent(&press); |
95 | 95 |
96 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, release_location, | 96 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, release_location, |
97 5, base::TimeDelta::FromMilliseconds(50)); | 97 5, base::TimeDelta::FromMilliseconds(50)); |
98 rwhd->OnHostTouchEvent(&release); | 98 rwhd->OnHostTouchEvent(&release); |
99 } | 99 } |
100 #endif // defined(USE_AURA) | 100 #endif // defined(USE_AURA) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // not there was text under the tap, which appears to be flaky. | 227 // not there was text under the tap, which appears to be flaky. |
228 | 228 |
229 // Take the focus away and tap in the omnibox again, but drag a bit before | 229 // Take the focus away and tap in the omnibox again, but drag a bit before |
230 // releasing. We should focus the omnibox but not select all of its text. | 230 // releasing. We should focus the omnibox but not select all of its text. |
231 ASSERT_NO_FATAL_FAILURE(TapBrowserWindowCenter()); | 231 ASSERT_NO_FATAL_FAILURE(TapBrowserWindowCenter()); |
232 ASSERT_NO_FATAL_FAILURE(Tap(tap_location, tap2_location)); | 232 ASSERT_NO_FATAL_FAILURE(Tap(tap_location, tap2_location)); |
233 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | 233 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
234 EXPECT_FALSE(omnibox_view->IsSelectAll()); | 234 EXPECT_FALSE(omnibox_view->IsSelectAll()); |
235 } | 235 } |
236 #endif // defined(USE_AURA) | 236 #endif // defined(USE_AURA) |
OLD | NEW |