Commit 5bca36bc authored by tapted@chromium.org's avatar tapted@chromium.org

MacViews: Remove aura dependency from omnibox_view_views_browsertest

This is done by using the cross-platform EventGenerator to craft and
dispatch test events.

BUG=399191

Review URL: https://codereview.chromium.org/444493005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287707 0039d316-1c4b-4281-b951-d872f2087c98
parent ad88587f
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/interactive_test_utils.h"
#include "grit/generated_resources.h" #include "grit/generated_resources.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/ime/text_input_focus_manager.h" #include "ui/base/ime/text_input_focus_manager.h"
...@@ -73,35 +71,22 @@ class OmniboxViewViewsTest : public InProcessBrowserTest { ...@@ -73,35 +71,22 @@ class OmniboxViewViewsTest : public InProcessBrowserTest {
void TapBrowserWindowCenter() { void TapBrowserWindowCenter() {
gfx::Point center = BrowserView::GetBrowserViewForBrowser( gfx::Point center = BrowserView::GetBrowserViewForBrowser(
browser())->GetBoundsInScreen().CenterPoint(); browser())->GetBoundsInScreen().CenterPoint();
ui::test::EventGenerator generator( ui::test::EventGenerator generator(browser()->window()->GetNativeWindow());
browser()->window()->GetNativeWindow()->GetRootWindow());
generator.GestureTapAt(center); generator.GestureTapAt(center);
} }
// Touch down and release at the specified locations. // Touch down and release at the specified locations.
void Tap(const gfx::Point& press_location, void Tap(const gfx::Point& press_location,
const gfx::Point& release_location) { const gfx::Point& release_location) {
ui::EventProcessor* dispatcher = ui::test::EventGenerator generator(browser()->window()->GetNativeWindow());
browser()->window()->GetNativeWindow()->GetHost()->event_processor(); if (press_location == release_location) {
generator.GestureTapAt(press_location);
base::TimeDelta timestamp = ui::EventTimeForNow(); } else {
ui::TouchEvent press( generator.GestureScrollSequence(press_location,
ui::ET_TOUCH_PRESSED, press_location, 5, timestamp); release_location,
ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); base::TimeDelta::FromMilliseconds(10),
ASSERT_FALSE(details.dispatcher_destroyed); 1);
if (press_location != release_location) {
timestamp += base::TimeDelta::FromMilliseconds(10);
ui::TouchEvent move(
ui::ET_TOUCH_MOVED, release_location, 5, timestamp);
details = dispatcher->OnEventFromSource(&move);
} }
timestamp += base::TimeDelta::FromMilliseconds(50);
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, release_location, 5, timestamp);
details = dispatcher->OnEventFromSource(&release);
ASSERT_FALSE(details.dispatcher_destroyed);
} }
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment