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