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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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/in_process_browser_test.h" 12 #include "chrome/test/in_process_browser_test.h"
13 #include "chrome/test/ui_test_utils.h" 13 #include "chrome/test/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/common/notification_type.h" 18 #include "content/common/content_notification_types.h"
19 19
20 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include <atlbase.h> 21 #include <atlbase.h>
22 #include <atlcom.h> 22 #include <atlcom.h>
23 #endif 23 #endif
24 24
25 using webkit_glue::WebAccessibility; 25 using webkit_glue::WebAccessibility;
26 26
27 namespace { 27 namespace {
28 28
29 class RendererAccessibilityBrowserTest : public InProcessBrowserTest { 29 class RendererAccessibilityBrowserTest : public InProcessBrowserTest {
30 public: 30 public:
31 RendererAccessibilityBrowserTest() {} 31 RendererAccessibilityBrowserTest() {}
32 32
33 // Tell the renderer to send an accessibility tree, then wait for the 33 // Tell the renderer to send an accessibility tree, then wait for the
34 // notification that it's been received. 34 // notification that it's been received.
35 const WebAccessibility& GetWebAccessibilityTree() { 35 const WebAccessibility& GetWebAccessibilityTree() {
36 RenderWidgetHostView* host_view = 36 RenderWidgetHostView* host_view =
37 browser()->GetSelectedTabContents()->GetRenderWidgetHostView(); 37 browser()->GetSelectedTabContents()->GetRenderWidgetHostView();
38 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); 38 RenderWidgetHost* host = host_view->GetRenderWidgetHost();
39 RenderViewHost* view_host = static_cast<RenderViewHost*>(host); 39 RenderViewHost* view_host = static_cast<RenderViewHost*>(host);
40 view_host->set_save_accessibility_tree_for_testing(true); 40 view_host->set_save_accessibility_tree_for_testing(true);
41 view_host->EnableRendererAccessibility(); 41 view_host->EnableRendererAccessibility();
42 ui_test_utils::WaitForNotification( 42 ui_test_utils::WaitForNotification(
43 NotificationType::RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED); 43 content::NOTIFICATION_RENDER_VIEW_HOST_ACCESSIBILITY_TREE_UPDATED);
44 return view_host->accessibility_tree(); 44 return view_host->accessibility_tree();
45 } 45 }
46 46
47 // Make sure each node in the tree has an unique id. 47 // Make sure each node in the tree has an unique id.
48 void RecursiveAssertUniqueIds( 48 void RecursiveAssertUniqueIds(
49 const WebAccessibility& node, base::hash_set<int>* ids) { 49 const WebAccessibility& node, base::hash_set<int>* ids) {
50 ASSERT_TRUE(ids->find(node.id) == ids->end()); 50 ASSERT_TRUE(ids->find(node.id) == ids->end());
51 ids->insert(node.id); 51 ids->insert(node.id);
52 for (size_t i = 0; i < node.children.size(); i++) 52 for (size_t i = 0; i < node.children.size(); i++)
53 RecursiveAssertUniqueIds(node.children[i], ids); 53 RecursiveAssertUniqueIds(node.children[i], ids);
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 "<em><code ><h4 ></em>"; 328 "<em><code ><h4 ></em>";
329 GURL url(url_str); 329 GURL url(url_str);
330 browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); 330 browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED);
331 331
332 const WebAccessibility& tree = GetWebAccessibilityTree(); 332 const WebAccessibility& tree = GetWebAccessibilityTree();
333 base::hash_set<int> ids; 333 base::hash_set<int> ids;
334 RecursiveAssertUniqueIds(tree, &ids); 334 RecursiveAssertUniqueIds(tree, &ids);
335 } 335 }
336 336
337 } // namespace 337 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/accessibility/accessibility_win_browsertest.cc ('k') | chrome/browser/accessibility_events.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698