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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 ui::EventProcessor* dispatcher = | 80 ui::EventProcessor* dispatcher = |
81 browser()->window()->GetNativeWindow()->GetHost()->event_processor(); | 81 browser()->window()->GetNativeWindow()->GetHost()->event_processor(); |
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 if (press_location != release_location) { | |
89 ui::TouchEvent move(ui::ET_TOUCH_MOVED, | |
90 release_location, | |
91 5, | |
92 base::TimeDelta::FromMilliseconds(10)); | |
Peter Kasting
2014/05/29 18:05:44
Nit: Since the code just above combines args onto
tdresser
2014/05/30 14:05:37
Done.
| |
93 details = dispatcher->OnEventFromSource(&move); | |
94 } | |
95 | |
88 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, release_location, | 96 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, release_location, |
89 5, base::TimeDelta::FromMilliseconds(50)); | 97 5, base::TimeDelta::FromMilliseconds(50)); |
90 details = dispatcher->OnEventFromSource(&release); | 98 details = dispatcher->OnEventFromSource(&release); |
91 ASSERT_FALSE(details.dispatcher_destroyed); | 99 ASSERT_FALSE(details.dispatcher_destroyed); |
92 } | 100 } |
93 | 101 |
94 private: | 102 private: |
95 // InProcessBrowserTest: | 103 // InProcessBrowserTest: |
96 virtual void SetUpOnMainThread() OVERRIDE { | 104 virtual void SetUpOnMainThread() OVERRIDE { |
97 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 105 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
317 omnibox_view_views->GetBoundsInScreen().CenterPoint(); | 325 omnibox_view_views->GetBoundsInScreen().CenterPoint(); |
318 Tap(omnibox_center, omnibox_center); | 326 Tap(omnibox_center, omnibox_center); |
319 EXPECT_TRUE(textfield_test_api.touch_selection_controller()); | 327 EXPECT_TRUE(textfield_test_api.touch_selection_controller()); |
320 | 328 |
321 // Execute a command and check if it deactivate touch editing. Paste & Go is | 329 // Execute a command and check if it deactivate touch editing. Paste & Go is |
322 // chosen since it is specific to Omnibox and its execution wouldn't be | 330 // chosen since it is specific to Omnibox and its execution wouldn't be |
323 // delgated to the base Textfield class. | 331 // delgated to the base Textfield class. |
324 omnibox_view_views->ExecuteCommand(IDS_PASTE_AND_GO, ui::EF_NONE); | 332 omnibox_view_views->ExecuteCommand(IDS_PASTE_AND_GO, ui::EF_NONE); |
325 EXPECT_FALSE(textfield_test_api.touch_selection_controller()); | 333 EXPECT_FALSE(textfield_test_api.touch_selection_controller()); |
326 } | 334 } |
OLD | NEW |