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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 browser())->GetBoundsInScreen().CenterPoint(); | 71 browser())->GetBoundsInScreen().CenterPoint(); |
72 aura::test::EventGenerator generator(browser()->window()-> | 72 aura::test::EventGenerator generator(browser()->window()-> |
73 GetNativeWindow()->GetRootWindow()); | 73 GetNativeWindow()->GetRootWindow()); |
74 generator.GestureTapAt(center); | 74 generator.GestureTapAt(center); |
75 } | 75 } |
76 | 76 |
77 // Touch down and release at the specified locations. | 77 // Touch down and release at the specified locations. |
78 void Tap(const gfx::Point& press_location, | 78 void Tap(const gfx::Point& press_location, |
79 const gfx::Point& release_location) { | 79 const gfx::Point& release_location) { |
80 aura::WindowEventDispatcher* dispatcher = | 80 aura::WindowEventDispatcher* dispatcher = |
81 browser()->window()->GetNativeWindow()->GetDispatcher(); | 81 browser()->window()->GetNativeWindow()->GetHost()->dispatcher(); |
82 | 82 |
83 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, press_location, | 83 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, press_location, |
84 5, base::TimeDelta::FromMilliseconds(0)); | 84 5, base::TimeDelta::FromMilliseconds(0)); |
85 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); | 85 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); |
86 ASSERT_FALSE(details.dispatcher_destroyed); | 86 ASSERT_FALSE(details.dispatcher_destroyed); |
87 | 87 |
88 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, release_location, | 88 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, release_location, |
89 5, base::TimeDelta::FromMilliseconds(50)); | 89 5, base::TimeDelta::FromMilliseconds(50)); |
90 details = dispatcher->OnEventFromSource(&release); | 90 details = dispatcher->OnEventFromSource(&release); |
91 ASSERT_FALSE(details.dispatcher_destroyed); | 91 ASSERT_FALSE(details.dispatcher_destroyed); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // not there was text under the tap, which appears to be flaky. | 215 // not there was text under the tap, which appears to be flaky. |
216 | 216 |
217 // Take the focus away and tap in the omnibox again, but drag a bit before | 217 // Take the focus away and tap in the omnibox again, but drag a bit before |
218 // releasing. We should focus the omnibox but not select all of its text. | 218 // releasing. We should focus the omnibox but not select all of its text. |
219 ASSERT_NO_FATAL_FAILURE(TapBrowserWindowCenter()); | 219 ASSERT_NO_FATAL_FAILURE(TapBrowserWindowCenter()); |
220 ASSERT_NO_FATAL_FAILURE(Tap(tap_location, tap2_location)); | 220 ASSERT_NO_FATAL_FAILURE(Tap(tap_location, tap2_location)); |
221 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); | 221 EXPECT_TRUE(ui_test_utils::IsViewFocused(browser(), VIEW_ID_OMNIBOX)); |
222 EXPECT_FALSE(omnibox_view->IsSelectAll()); | 222 EXPECT_FALSE(omnibox_view->IsSelectAll()); |
223 } | 223 } |
224 #endif // defined(USE_AURA) | 224 #endif // defined(USE_AURA) |
OLD | NEW |