OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/logging.h" | 8 #include "base/logging.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/browser_tabstrip.h" |
14 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/browser/accessibility/browser_accessibility.h" | 17 #include "content/browser/accessibility/browser_accessibility.h" |
17 #include "content/browser/accessibility/browser_accessibility_manager.h" | 18 #include "content/browser/accessibility/browser_accessibility_manager.h" |
18 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" | 19 #include "content/browser/accessibility/dump_accessibility_tree_helper.h" |
19 #include "content/browser/renderer_host/render_view_host_impl.h" | 20 #include "content/browser/renderer_host/render_view_host_impl.h" |
20 #include "content/port/browser/render_widget_host_view_port.h" | 21 #include "content/port/browser/render_widget_host_view_port.h" |
21 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_types.h" | 23 #include "content/public/browser/notification_types.h" |
23 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Actual file has been fully checked. | 78 // Actual file has been fully checked. |
78 return diff_lines; | 79 return diff_lines; |
79 } | 80 } |
80 | 81 |
81 DumpAccessibilityTreeHelper helper_; | 82 DumpAccessibilityTreeHelper helper_; |
82 }; | 83 }; |
83 | 84 |
84 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, | 85 IN_PROC_BROWSER_TEST_F(DumpAccessibilityTreeTest, |
85 PlatformTreeDifferenceTest) { | 86 PlatformTreeDifferenceTest) { |
86 RenderWidgetHostViewPort* host_view = static_cast<RenderWidgetHostViewPort*>( | 87 RenderWidgetHostViewPort* host_view = static_cast<RenderWidgetHostViewPort*>( |
87 browser()->GetActiveWebContents()->GetRenderWidgetHostView()); | 88 chrome::GetActiveWebContents(browser())->GetRenderWidgetHostView()); |
88 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); | 89 RenderWidgetHost* host = host_view->GetRenderWidgetHost(); |
89 RenderViewHostImpl* view_host = | 90 RenderViewHostImpl* view_host = |
90 static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(host)); | 91 static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(host)); |
91 view_host->set_save_accessibility_tree_for_testing(true); | 92 view_host->set_save_accessibility_tree_for_testing(true); |
92 view_host->SetAccessibilityMode(AccessibilityModeComplete); | 93 view_host->SetAccessibilityMode(AccessibilityModeComplete); |
93 | 94 |
94 // Setup test paths. | 95 // Setup test paths. |
95 FilePath dir_test_data; | 96 FilePath dir_test_data; |
96 EXPECT_TRUE(PathService::Get(content::DIR_TEST_DATA, &dir_test_data)); | 97 EXPECT_TRUE(PathService::Get(content::DIR_TEST_DATA, &dir_test_data)); |
97 FilePath test_path(dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); | 98 FilePath test_path(dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 195 |
195 EXPECT_TRUE(file_util::WriteFile( | 196 EXPECT_TRUE(file_util::WriteFile( |
196 actual_file, actual_contents.c_str(), actual_contents.size())); | 197 actual_file, actual_contents.c_str(), actual_contents.size())); |
197 | 198 |
198 ADD_FAILURE() << "No expectation found. Create it by doing:\n" | 199 ADD_FAILURE() << "No expectation found. Create it by doing:\n" |
199 << "mv " << actual_file.LossyDisplayName() << " " | 200 << "mv " << actual_file.LossyDisplayName() << " " |
200 << expected_file.LossyDisplayName(); | 201 << expected_file.LossyDisplayName(); |
201 } | 202 } |
202 } while (!(html_file = file_enumerator.Next()).empty()); | 203 } while (!(html_file = file_enumerator.Next()).empty()); |
203 } | 204 } |
OLD | NEW |