summaryrefslogtreecommitdiffstats
path: root/chrome_frame/test/win_event_receiver.cc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 17:04:24 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 17:04:24 +0000
commit39f7f17f35ec7f78a2b5b413d4b0b02fc216da61 (patch)
tree08ce71d716ee7cf4106e035f78cf2a877933ea6f /chrome_frame/test/win_event_receiver.cc
parent4aad7cc13daa4baa068a8e138ba2b5c3596cbeb4 (diff)
downloadchromium_src-39f7f17f35ec7f78a2b5b413d4b0b02fc216da61.zip
chromium_src-39f7f17f35ec7f78a2b5b413d4b0b02fc216da61.tar.gz
chromium_src-39f7f17f35ec7f78a2b5b413d4b0b02fc216da61.tar.bz2
[chrome_frame] Add utils for using MSAA for working with menus and for selecting/focusing elements. Change context menu tests to use this approach.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3115002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56373 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/win_event_receiver.cc')
-rw-r--r--chrome_frame/test/win_event_receiver.cc32
1 files changed, 29 insertions, 3 deletions
diff --git a/chrome_frame/test/win_event_receiver.cc b/chrome_frame/test/win_event_receiver.cc
index 18debbf..b967d5c 100644
--- a/chrome_frame/test/win_event_receiver.cc
+++ b/chrome_frame/test/win_event_receiver.cc
@@ -9,6 +9,8 @@
#include "chrome_frame/function_stub.h"
+#include "third_party/xulrunner-sdk/win/include/accessibility/AccessibleEventId.h"
+
// WinEventReceiver methods
WinEventReceiver::WinEventReceiver()
: listener_(NULL),
@@ -49,9 +51,12 @@ bool WinEventReceiver::InitializeHook(DWORD event_min, DWORD event_max) {
DCHECK(hook_stub_ == NULL);
hook_stub_ = FunctionStub::Create(reinterpret_cast<uintptr_t>(this),
WinEventHook);
+ // Don't use WINEVENT_SKIPOWNPROCESS here because we fake generate an event
+ // in the mock IE event sink (IA2_EVENT_DOCUMENT_LOAD_COMPLETE) that we want
+ // to catch.
hook_ = SetWinEventHook(event_min, event_max, NULL,
reinterpret_cast<WINEVENTPROC>(hook_stub_->code()), 0,
- 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS);
+ 0, WINEVENT_OUTOFCONTEXT);
DLOG_IF(ERROR, hook_ == NULL) << "Unable to SetWinEvent hook";
return hook_ != NULL;
}
@@ -62,7 +67,7 @@ void WinEventReceiver::WinEventHook(WinEventReceiver* me, HWINEVENTHOOK hook,
LONG child_id, DWORD event_thread_id,
DWORD event_time) {
DCHECK(me->listener_ != NULL);
- me->listener_->OnEventReceived(event, hwnd);
+ me->listener_->OnEventReceived(event, hwnd, object_id, child_id);
}
// WindowWatchdog methods
@@ -84,7 +89,8 @@ void WindowWatchdog::RemoveObserver(WindowObserver* observer) {
win_event_receiver_.StopReceivingEvents();
}
-void WindowWatchdog::OnEventReceived(DWORD event, HWND hwnd) {
+void WindowWatchdog::OnEventReceived(DWORD event, HWND hwnd, LONG object_id,
+ LONG child_id) {
// We need to look for top level windows and a natural check is for
// WS_CHILD. Instead, checking for WS_CAPTION allows us to filter
// out other stray popups
@@ -111,3 +117,23 @@ void WindowWatchdog::OnEventReceived(DWORD event, HWND hwnd) {
i->observer->OnWindowDetected(hwnd, caption);
}
}
+
+// AccessibilityEventListener methods
+AccessibilityEventObserver::AccessibilityEventObserver() {
+ event_receiver_.SetListenerForEvents(this, EVENT_SYSTEM_MENUPOPUPSTART,
+ IA2_EVENT_DOCUMENT_LOAD_COMPLETE);
+}
+
+void AccessibilityEventObserver::OnEventReceived(DWORD event,
+ HWND hwnd,
+ LONG object_id,
+ LONG child_id) {
+ switch (event) {
+ case EVENT_SYSTEM_MENUPOPUPSTART:
+ OnMenuPopup(hwnd);
+ break;
+ case IA2_EVENT_DOCUMENT_LOAD_COMPLETE:
+ OnAccDocLoad(hwnd);
+ break;
+ }
+}