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

Side by Side Diff: chrome/browser/accessibility/renderer_accessibility_browsertest.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
12 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
13 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
14 #include "content/browser/renderer_host/render_view_host.h" 14 #include "content/browser/renderer_host/render_view_host.h"
15 #include "content/browser/renderer_host/render_widget_host.h" 15 #include "content/browser/renderer_host/render_widget_host.h"
16 #include "content/browser/renderer_host/render_widget_host_view.h" 16 #include "content/browser/renderer_host/render_widget_host_view.h"
17 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
18 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 19 #include "content/public/browser/notification_types.h"
19 20
20 #if defined(OS_WIN) 21 #if defined(OS_WIN)
21 #include <atlbase.h> 22 #include <atlbase.h>
22 #include <atlcom.h> 23 #include <atlcom.h>
23 #endif 24 #endif
24 25
25 using webkit_glue::WebAccessibility; 26 using webkit_glue::WebAccessibility;
26 27
27 namespace { 28 namespace {
28 29
29 class RendererAccessibilityBrowserTest : public InProcessBrowserTest { 30 class RendererAccessibilityBrowserTest : public InProcessBrowserTest {
30 public: 31 public:
31 RendererAccessibilityBrowserTest() {} 32 RendererAccessibilityBrowserTest() {}
32 33
33 // Tell the renderer to send an accessibility tree, then wait for the 34 // Tell the renderer to send an accessibility tree, then wait for the
34 // notification that it's been received. 35 // notification that it's been received.
35 const WebAccessibility& GetWebAccessibilityTree() { 36 const WebAccessibility& GetWebAccessibilityTree() {
36 ui_test_utils::WindowedNotificationObserver tree_updated_observer( 37 ui_test_utils::WindowedNotificationObserver tree_updated_observer(
37 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED, 38 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED,
38 NotificationService::AllSources()); 39 content::NotificationService::AllSources());
39 RenderWidgetHostView* host_view = 40 RenderWidgetHostView* host_view =
40 browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); 41 browser()->GetSelectedTabContents()->GetRenderWidgetHostView();
41 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); 42 RenderWidgetHost* host = host_view->GetRenderWidgetHost();
42 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); 43 RenderViewHost* view_host = static_cast<RenderViewHost*>(host);
43 view_host->set_save_accessibility_tree_for_testing(true); 44 view_host->set_save_accessibility_tree_for_testing(true);
44 view_host->EnableRendererAccessibility(); 45 view_host->EnableRendererAccessibility();
45 tree_updated_observer.Wait(); 46 tree_updated_observer.Wait();
46 return view_host->accessibility_tree_for_testing(); 47 return view_host->accessibility_tree_for_testing();
47 } 48 }
48 49
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 const WebAccessibility& tree = GetWebAccessibilityTree(); 449 const WebAccessibility& tree = GetWebAccessibilityTree();
449 450
450 ASSERT_EQ(1U, tree.children.size()); 451 ASSERT_EQ(1U, tree.children.size());
451 const WebAccessibility& textbox = tree.children[0]; 452 const WebAccessibility& textbox = tree.children[0];
452 453
453 EXPECT_EQ( 454 EXPECT_EQ(
454 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE)); 455 true, GetBoolAttr(textbox, WebAccessibility::ATTR_CAN_SET_VALUE));
455 } 456 }
456 457
457 } // namespace 458 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/accessibility/accessibility_win_browsertest.cc ('k') | chrome/browser/accessibility_events.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698