OLD | NEW |
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/dump_accessibility_browsertest_base.h" | 5 #include "content/browser/accessibility/dump_accessibility_browsertest_base.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/string_split.h" | 13 #include "base/strings/string_split.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "content/browser/accessibility/accessibility_tree_formatter.h" | 16 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
17 #include "content/browser/accessibility/browser_accessibility.h" | 17 #include "content/browser/accessibility/browser_accessibility.h" |
18 #include "content/browser/accessibility/browser_accessibility_manager.h" | 18 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 19 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
19 #include "content/browser/web_contents/web_contents_impl.h" | 20 #include "content/browser/web_contents/web_contents_impl.h" |
20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
21 #include "content/public/common/content_paths.h" | 22 #include "content/public/common/content_paths.h" |
22 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
23 #include "content/public/test/content_browser_test.h" | 24 #include "content/public/test/content_browser_test.h" |
24 #include "content/public/test/content_browser_test_utils.h" | 25 #include "content/public/test/content_browser_test_utils.h" |
25 #include "content/shell/browser/shell.h" | 26 #include "content/shell/browser/shell.h" |
26 #include "content/test/accessibility_browser_test_utils.h" | 27 #include "content/test/accessibility_browser_test_utils.h" |
27 | 28 |
28 namespace content { | 29 namespace content { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 line.substr(deny_str.size())), | 115 line.substr(deny_str.size())), |
115 Filter::DENY)); | 116 Filter::DENY)); |
116 } else if (StartsWithASCII(line, wait_str, true)) { | 117 } else if (StartsWithASCII(line, wait_str, true)) { |
117 *wait_for = line.substr(wait_str.size()); | 118 *wait_for = line.substr(wait_str.size()); |
118 } | 119 } |
119 } | 120 } |
120 } | 121 } |
121 | 122 |
122 void DumpAccessibilityTestBase::RunTest( | 123 void DumpAccessibilityTestBase::RunTest( |
123 const base::FilePath file_path, const char* file_dir) { | 124 const base::FilePath file_path, const char* file_dir) { |
| 125 // Disable the "hot tracked" state (set when the mouse is hovering over |
| 126 // an object) because it makes test output change based on the mouse position. |
| 127 BrowserAccessibilityStateImpl::GetInstance()-> |
| 128 set_disable_hot_tracking_for_testing(true); |
| 129 |
124 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); | 130 NavigateToURL(shell(), GURL(url::kAboutBlankURL)); |
125 | 131 |
126 // Output the test path to help anyone who encounters a failure and needs | 132 // Output the test path to help anyone who encounters a failure and needs |
127 // to know where to look. | 133 // to know where to look. |
128 printf("Testing: %s\n", file_path.MaybeAsASCII().c_str()); | 134 printf("Testing: %s\n", file_path.MaybeAsASCII().c_str()); |
129 | 135 |
130 std::string html_contents; | 136 std::string html_contents; |
131 base::ReadFileToString(file_path, &html_contents); | 137 base::ReadFileToString(file_path, &html_contents); |
132 | 138 |
133 // Read the expected file. | 139 // Read the expected file. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 EXPECT_TRUE(base::WriteFile( | 237 EXPECT_TRUE(base::WriteFile( |
232 actual_file, actual_contents.c_str(), actual_contents.size())); | 238 actual_file, actual_contents.c_str(), actual_contents.size())); |
233 | 239 |
234 ADD_FAILURE() << "No expectation found. Create it by doing:\n" | 240 ADD_FAILURE() << "No expectation found. Create it by doing:\n" |
235 << "mv " << actual_file.LossyDisplayName() << " " | 241 << "mv " << actual_file.LossyDisplayName() << " " |
236 << expected_file.LossyDisplayName(); | 242 << expected_file.LossyDisplayName(); |
237 } | 243 } |
238 } | 244 } |
239 | 245 |
240 } // namespace content | 246 } // namespace content |
OLD | NEW |