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

Side by Side Diff: content/test/accessibility_browser_test_utils.cc

Issue 145283003: Switch AccessibilityMode to be a bitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src@enable
Patch Set: Tweak AccessibilityModeHelperTest Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/test/accessibility_browser_test_utils.h" 5 #include "content/test/accessibility_browser_test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "content/browser/renderer_host/render_view_host_impl.h" 11 #include "content/browser/renderer_host/render_view_host_impl.h"
12 #include "content/common/view_message_enums.h"
12 #include "content/port/browser/render_widget_host_view_port.h" 13 #include "content/port/browser/render_widget_host_view_port.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/url_constants.h" 15 #include "content/public/common/url_constants.h"
15 #include "content/public/test/test_utils.h" 16 #include "content/public/test/test_utils.h"
16 #include "content/shell/browser/shell.h" 17 #include "content/shell/browser/shell.h"
17 #include "ui/accessibility/ax_node.h" 18 #include "ui/accessibility/ax_node.h"
18 19
19 namespace content { 20 namespace content {
20 21
21 AccessibilityNotificationWaiter::AccessibilityNotificationWaiter( 22 AccessibilityNotificationWaiter::AccessibilityNotificationWaiter(
22 Shell* shell, 23 Shell* shell,
23 AccessibilityMode accessibility_mode, 24 AccessibilityMode accessibility_mode,
24 ui::AXEvent event_type) 25 ui::AXEvent event_type)
25 : shell_(shell), 26 : shell_(shell),
26 event_to_wait_for_(event_type), 27 event_to_wait_for_(event_type),
27 loop_runner_(new MessageLoopRunner()), 28 loop_runner_(new MessageLoopRunner()),
28 weak_factory_(this) { 29 weak_factory_(this) {
29 WebContents* web_contents = shell_->web_contents(); 30 WebContents* web_contents = shell_->web_contents();
30 view_host_ = static_cast<RenderViewHostImpl*>( 31 view_host_ = static_cast<RenderViewHostImpl*>(
31 web_contents->GetRenderViewHost()); 32 web_contents->GetRenderViewHost());
32 view_host_->SetAccessibilityCallbackForTesting( 33 view_host_->SetAccessibilityCallbackForTesting(
33 base::Bind(&AccessibilityNotificationWaiter::OnAccessibilityEvent, 34 base::Bind(&AccessibilityNotificationWaiter::OnAccessibilityEvent,
34 weak_factory_.GetWeakPtr())); 35 weak_factory_.GetWeakPtr()));
35 view_host_->SetAccessibilityMode(accessibility_mode); 36 view_host_->AddAccessibilityMode(accessibility_mode);
36 } 37 }
37 38
38 AccessibilityNotificationWaiter::~AccessibilityNotificationWaiter() { 39 AccessibilityNotificationWaiter::~AccessibilityNotificationWaiter() {
39 } 40 }
40 41
41 void AccessibilityNotificationWaiter::WaitForNotification() { 42 void AccessibilityNotificationWaiter::WaitForNotification() {
42 loop_runner_->Run(); 43 loop_runner_->Run();
43 } 44 }
44 45
45 const ui::AXTree& AccessibilityNotificationWaiter::GetAXTree() const { 46 const ui::AXTree& AccessibilityNotificationWaiter::GetAXTree() const {
(...skipping 14 matching lines...) Expand all
60 for (size_t i = 0; i < root.string_attributes.size(); ++i) { 61 for (size_t i = 0; i < root.string_attributes.size(); ++i) {
61 if (root.string_attributes[i].first != ui::AX_ATTR_DOC_URL) 62 if (root.string_attributes[i].first != ui::AX_ATTR_DOC_URL)
62 continue; 63 continue;
63 const std::string& doc_url = root.string_attributes[i].second; 64 const std::string& doc_url = root.string_attributes[i].second;
64 return doc_url == kAboutBlankURL; 65 return doc_url == kAboutBlankURL;
65 } 66 }
66 return false; 67 return false;
67 } 68 }
68 69
69 } // namespace content 70 } // namespace content
OLDNEW
« content/renderer/render_view_impl.cc ('K') | « content/renderer/render_view_impl_params.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698