Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: content/browser/accessibility/accessibility_event_recorder_win.cc

Issue 873313009: Add logging to debug DumpAccessibilityEvent* tests WinClang* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Just logging change for now Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/accessibility/accessibility_event_recorder.h" 5 #include "content/browser/accessibility/accessibility_event_recorder.h"
6 6
7 #include <oleacc.h> 7 #include <oleacc.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 << " WinAccessibilityEventMonitor at a time."; 131 << " WinAccessibilityEventMonitor at a time.";
132 instance_ = this; 132 instance_ = this;
133 win_event_hook_handle_ = SetWinEventHook( 133 win_event_hook_handle_ = SetWinEventHook(
134 EVENT_MIN, 134 EVENT_MIN,
135 EVENT_MAX, 135 EVENT_MAX,
136 GetModuleHandle(NULL), 136 GetModuleHandle(NULL),
137 &AccessibilityEventRecorderWin::WinEventHookThunk, 137 &AccessibilityEventRecorderWin::WinEventHookThunk,
138 GetCurrentProcessId(), 138 GetCurrentProcessId(),
139 0, // Hook all threads 139 0, // Hook all threads
140 WINEVENT_INCONTEXT); 140 WINEVENT_INCONTEXT);
141 LOG(INFO) << "SetWinEventHook handle: " << win_event_hook_handle_;
142 CHECK(win_event_hook_handle_);
141 } 143 }
142 144
143 AccessibilityEventRecorderWin::~AccessibilityEventRecorderWin() { 145 AccessibilityEventRecorderWin::~AccessibilityEventRecorderWin() {
144 UnhookWinEvent(win_event_hook_handle_); 146 UnhookWinEvent(win_event_hook_handle_);
145 instance_ = NULL; 147 instance_ = NULL;
146 } 148 }
147 149
148 void AccessibilityEventRecorderWin::OnWinEventHook( 150 void AccessibilityEventRecorderWin::OnWinEventHook(
149 HWINEVENTHOOK handle, 151 HWINEVENTHOOK handle,
150 DWORD event, 152 DWORD event,
151 HWND hwnd, 153 HWND hwnd,
152 LONG obj_id, 154 LONG obj_id,
153 LONG child_id, 155 LONG child_id,
154 DWORD event_thread, 156 DWORD event_thread,
155 DWORD event_time) { 157 DWORD event_time) {
158 // http://crbug.com/440579 TODO(dmazzoni): remove most logging in this file,
159 // or change to VLOG(1), once flakiness on CrWinClang testers is fixed.
160 LOG(INFO) << "OnWinEventHook handle=" << handle
161 << " event=" << event
162 << " hwnd=" << hwnd
163 << " obj_id=" << obj_id
164 << " child_id=" << child_id
165 << " event_thread=" << event_thread
166 << " event_time=" << event_time;
167
156 base::win::ScopedComPtr<IAccessible> browser_accessible; 168 base::win::ScopedComPtr<IAccessible> browser_accessible;
157 HRESULT hr = AccessibleObjectFromWindow( 169 HRESULT hr = AccessibleObjectFromWindow(
158 hwnd, 170 hwnd,
159 obj_id, 171 obj_id,
160 IID_IAccessible, 172 IID_IAccessible,
161 reinterpret_cast<void**>(browser_accessible.Receive())); 173 reinterpret_cast<void**>(browser_accessible.Receive()));
162 if (!SUCCEEDED(hr)) { 174 if (!SUCCEEDED(hr)) {
163 // Note: our event hook will pick up some superfluous events we 175 // Note: our event hook will pick up some superfluous events we
164 // don't care about, so it's safe to just ignore these failures. 176 // don't care about, so it's safe to just ignore these failures.
165 // Same below for other HRESULT checks. 177 // Same below for other HRESULT checks.
166 VLOG(1) << "Ignoring result " << hr << " from AccessibleObjectFromWindow"; 178 LOG(INFO) << "Ignoring result " << hr << " from AccessibleObjectFromWindow";
167 return; 179 return;
168 } 180 }
169 181
170 base::win::ScopedVariant childid_variant(child_id); 182 base::win::ScopedVariant childid_variant(child_id);
171 base::win::ScopedComPtr<IDispatch> dispatch; 183 base::win::ScopedComPtr<IDispatch> dispatch;
172 hr = browser_accessible->get_accChild(childid_variant, dispatch.Receive()); 184 hr = browser_accessible->get_accChild(childid_variant, dispatch.Receive());
173 if (!SUCCEEDED(hr) || !dispatch) { 185 if (!SUCCEEDED(hr) || !dispatch) {
174 VLOG(1) << "Ignoring result " << hr << " and result " << dispatch 186 LOG(INFO) << "Ignoring result " << hr << " and result " << dispatch
175 << " from get_accChild"; 187 << " from get_accChild";
176 return; 188 return;
177 } 189 }
178 190
179 base::win::ScopedComPtr<IAccessible> iaccessible; 191 base::win::ScopedComPtr<IAccessible> iaccessible;
180 hr = dispatch.QueryInterface(iaccessible.Receive()); 192 hr = dispatch.QueryInterface(iaccessible.Receive());
181 if (!SUCCEEDED(hr)) { 193 if (!SUCCEEDED(hr)) {
182 VLOG(1) << "Ignoring result " << hr << " from QueryInterface"; 194 LOG(INFO) << "Ignoring result " << hr << " from QueryInterface";
183 return; 195 return;
184 } 196 }
185 197
186 std::string event_str = AccessibilityEventToStringUTF8(event); 198 std::string event_str = AccessibilityEventToStringUTF8(event);
187 if (event_str.empty()) { 199 if (event_str.empty()) {
188 VLOG(1) << "Ignoring event " << event; 200 LOG(INFO) << "Ignoring event " << event;
189 return; 201 return;
190 } 202 }
191 203
192 base::win::ScopedVariant childid_self(CHILDID_SELF); 204 base::win::ScopedVariant childid_self(CHILDID_SELF);
193 base::win::ScopedVariant role; 205 base::win::ScopedVariant role;
194 iaccessible->get_accRole(childid_self, role.Receive()); 206 iaccessible->get_accRole(childid_self, role.Receive());
195 base::win::ScopedBstr name_bstr; 207 base::win::ScopedBstr name_bstr;
196 iaccessible->get_accName(childid_self, name_bstr.Receive()); 208 iaccessible->get_accName(childid_self, name_bstr.Receive());
197 base::win::ScopedBstr value_bstr; 209 base::win::ScopedBstr value_bstr;
198 iaccessible->get_accValue(childid_self, value_bstr.Receive()); 210 iaccessible->get_accValue(childid_self, value_bstr.Receive());
(...skipping 23 matching lines...) Expand all
222 IA2TextSegment new_text; 234 IA2TextSegment new_text;
223 if (SUCCEEDED(accessible_text->get_newText(&new_text))) { 235 if (SUCCEEDED(accessible_text->get_newText(&new_text))) {
224 log += base::StringPrintf(" new_text={'%s' start=%d end=%d}", 236 log += base::StringPrintf(" new_text={'%s' start=%d end=%d}",
225 BstrToUTF8(new_text.text).c_str(), 237 BstrToUTF8(new_text.text).c_str(),
226 new_text.start, 238 new_text.start,
227 new_text.end); 239 new_text.end);
228 } 240 }
229 } 241 }
230 } 242 }
231 243
244 LOG(INFO) << "Got event log: " << log;
245
232 event_logs_.push_back(log); 246 event_logs_.push_back(log);
233 } 247 }
234 248
235 } // namespace content 249 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698