diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 23:08:30 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 23:08:30 +0000 |
commit | 1b5a48c29bca7371ed64c616d7d35a796d6a3341 (patch) | |
tree | 5492d89e4ea0d6389a13186c90f79a4a8f712323 /chrome/browser/views | |
parent | 83ffe9e621ae92d9a1bd32fd363f8dc5728010b0 (diff) | |
download | chromium_src-1b5a48c29bca7371ed64c616d7d35a796d6a3341.zip chromium_src-1b5a48c29bca7371ed64c616d7d35a796d6a3341.tar.gz chromium_src-1b5a48c29bca7371ed64c616d7d35a796d6a3341.tar.bz2 |
Implement UI automation on the Mac.
Code is untested. From gChat:
me: do you have a good test I can use to make sure mac impl of
ui_controls for sending events works OK? Or would you prefer I send
you CLs to play with and we iterate by hand?
Joe: I would like the CL to play with to see if I can get it to work
with the code I wrote
Warning to Joe: mouse moved events currently use the Mac coordinate
frame (0,0 is bottom-left not top-left). That's easy to switch; I'd
like to do whatever is easiest to get WebDriver working.
BUG=26102
Review URL: http://codereview.chromium.org/1701006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/bookmark_bar_view_test.cc | 20 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_host_interactive_uitest.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 31 |
3 files changed, 36 insertions, 17 deletions
diff --git a/chrome/browser/views/bookmark_bar_view_test.cc b/chrome/browser/views/bookmark_bar_view_test.cc index 2f895dc..46f87e0 100644 --- a/chrome/browser/views/bookmark_bar_view_test.cc +++ b/chrome/browser/views/bookmark_bar_view_test.cc @@ -860,7 +860,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a down event, which should select the first item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_DOWN, false, false, false, + NULL, base::VKEY_DOWN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step3)); } @@ -873,7 +873,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a key down event, which should select the next item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_DOWN, false, false, false, + NULL, base::VKEY_DOWN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step4)); } @@ -886,7 +886,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a right arrow to force the menu to open. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_RIGHT, false, false, false, + NULL, base::VKEY_RIGHT, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step5)); } @@ -902,7 +902,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a left arrow to close the submenu. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_LEFT, false, false, false, + NULL, base::VKEY_LEFT, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step6)); } @@ -917,7 +917,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send a down arrow to wrap back to f1a ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_DOWN, false, false, false, + NULL, base::VKEY_DOWN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step7)); } @@ -930,7 +930,7 @@ class BookmarkBarViewTest10 : public BookmarkBarViewEventTestBase { // Send enter, which should select the item. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_RETURN, false, false, false, + NULL, base::VKEY_RETURN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest10::Step8)); } @@ -985,7 +985,7 @@ class BookmarkBarViewTest11 : public BookmarkBarViewEventTestBase { void Step3() { // Send escape so that the context menu hides. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_ESCAPE, false, false, false, + NULL, base::VKEY_ESCAPE, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest11::Step4)); } @@ -1074,7 +1074,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { void Step4() { // Press tab to give focus to the cancel button. - ui_controls::SendKeyPress(NULL, base::VKEY_TAB, false, false, false); + ui_controls::SendKeyPress(NULL, base::VKEY_TAB, false, false, false, false); // For some reason return isn't processed correctly unless we delay. MessageLoop::current()->PostDelayedTask(FROM_HERE, @@ -1084,7 +1084,7 @@ class BookmarkBarViewTest12 : public BookmarkBarViewEventTestBase { void Step5() { // And press enter so that the cancel button is selected. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_RETURN, false, false, false, + NULL, base::VKEY_RETURN, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest12::Step6)); } @@ -1213,7 +1213,7 @@ class BookmarkBarViewTest14 : public BookmarkBarViewEventTestBase { // Send escape so that the context menu hides. ui_controls::SendKeyPressNotifyWhenDone( - NULL, base::VKEY_ESCAPE, false, false, false, + NULL, base::VKEY_ESCAPE, false, false, false, false, CreateEventTask(this, &BookmarkBarViewTest14::Step3)); } diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc index f4e9b27..f38ba01 100644 --- a/chrome/browser/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/views/find_bar_host_interactive_uitest.cc @@ -114,7 +114,7 @@ IN_PROC_BROWSER_TEST_F(FindInPageTest, CrashEscHandlers) { // This used to crash until bug 1303709 was fixed. ui_controls::SendKeyPressNotifyWhenDone( browser()->window()->GetNativeHandle(), base::VKEY_ESCAPE, - false, false, false, new MessageLoop::QuitTask()); + false, false, false, false, new MessageLoop::QuitTask()); ui_test_utils::RunMessageLoop(); } diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index e8ee1d9..09000b0 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -1191,20 +1191,39 @@ void BrowserView::ToggleCompactNavigationBar() { // to windows. The real fix to this bug is to disable the commands when they // won't do anything. We'll need something like an overall clipboard command // manager to do that. +#if !defined(OS_MACOSX) void BrowserView::Cut() { - ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_X, true, - false, false); + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_X, + true, false, false, false); } void BrowserView::Copy() { - ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_C, true, - false, false); + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_C, + true, false, false, false); } void BrowserView::Paste() { - ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_V, true, - false, false); + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_V, + true, false, false, false); } +#else +// Mac versions. Not tested by antyhing yet; +// don't assume written == works. +void BrowserView::Cut() { + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_X, + false, false, false, true); +} + +void BrowserView::Copy() { + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_C, + false, false, false, true); +} + +void BrowserView::Paste() { + ui_controls::SendKeyPress(GetNativeHandle(), base::VKEY_V, + false, false, false, true); +} +#endif /////////////////////////////////////////////////////////////////////////////// // BrowserView, BrowserWindowTesting implementation: |