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/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "base/thread_task_runner_handle.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "content/browser/accessibility/accessibility_tree_formatter.h" | 20 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
20 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" | 21 #include "content/browser/accessibility/accessibility_tree_formatter_blink.h" |
21 #include "content/browser/accessibility/browser_accessibility.h" | 22 #include "content/browser/accessibility/browser_accessibility.h" |
22 #include "content/browser/accessibility/browser_accessibility_manager.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager.h" |
23 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 25 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
24 #include "content/browser/web_contents/web_contents_impl.h" | 26 #include "content/browser/web_contents/web_contents_impl.h" |
25 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
26 #include "content/public/common/content_paths.h" | 28 #include "content/public/common/content_paths.h" |
27 #include "content/public/common/content_switches.h" | 29 #include "content/public/common/content_switches.h" |
28 #include "content/public/common/url_constants.h" | 30 #include "content/public/common/url_constants.h" |
29 #include "content/public/test/browser_test_utils.h" | 31 #include "content/public/test/browser_test_utils.h" |
30 #include "content/public/test/content_browser_test.h" | 32 #include "content/public/test/content_browser_test.h" |
31 #include "content/public/test/content_browser_test_utils.h" | 33 #include "content/public/test/content_browser_test_utils.h" |
32 #include "content/public/test/test_utils.h" | 34 #include "content/public/test/test_utils.h" |
33 #include "content/shell/browser/shell.h" | 35 #include "content/shell/browser/shell.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 for (FrameTreeNode* node : frame_tree->Nodes()) { | 256 for (FrameTreeNode* node : frame_tree->Nodes()) { |
255 // Ignore about:blank urls because of the case where a parent frame A | 257 // Ignore about:blank urls because of the case where a parent frame A |
256 // has a child iframe B and it writes to the document using | 258 // has a child iframe B and it writes to the document using |
257 // contentDocument.open() on the child frame B. | 259 // contentDocument.open() on the child frame B. |
258 // | 260 // |
259 // In this scenario, B's contentWindow.location.href matches A's url, | 261 // In this scenario, B's contentWindow.location.href matches A's url, |
260 // but B's url in the browser frame tree is still "about:blank". | 262 // but B's url in the browser frame tree is still "about:blank". |
261 std::string url = node->current_url().spec(); | 263 std::string url = node->current_url().spec(); |
262 if (url != url::kAboutBlankURL) | 264 if (url != url::kAboutBlankURL) |
263 all_frame_urls.push_back(url); | 265 all_frame_urls.push_back(url); |
| 266 |
| 267 // We won't get the correct coordinate transformations for |
| 268 // out-of-process iframes until each frame's surface is ready. |
| 269 RenderFrameHostImpl* current_frame_host = node->current_frame_host(); |
| 270 if (!current_frame_host) |
| 271 continue; |
| 272 RenderWidgetHostImpl* rwh = current_frame_host->GetRenderWidgetHost(); |
| 273 if (!rwh) |
| 274 continue; |
| 275 RenderWidgetHostViewBase* rwhv = rwh->GetView(); |
| 276 if (rwhv && rwhv->IsChildFrameForTesting()) { |
| 277 SurfaceHitTestReadyNotifier notifier( |
| 278 static_cast<RenderWidgetHostViewChildFrame*>(rwhv)); |
| 279 notifier.WaitForSurfaceReady(); |
| 280 } |
264 } | 281 } |
265 | 282 |
266 // Wait for the accessibility tree to fully load for all frames, | 283 // Wait for the accessibility tree to fully load for all frames, |
267 // by searching for the WEB_AREA node in the accessibility tree | 284 // by searching for the WEB_AREA node in the accessibility tree |
268 // with the url of each frame in our frame tree. Note that this | 285 // with the url of each frame in our frame tree. Note that this |
269 // doesn't support cases where there are two iframes with the | 286 // doesn't support cases where there are two iframes with the |
270 // exact same url. If all frames haven't loaded yet, set up a | 287 // exact same url. If all frames haven't loaded yet, set up a |
271 // listener for accessibility events on any frame and block | 288 // listener for accessibility events on any frame and block |
272 // until the next one is received. | 289 // until the next one is received. |
273 // | 290 // |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 expected_file, actual_contents.c_str(), actual_contents.size())); | 386 expected_file, actual_contents.c_str(), actual_contents.size())); |
370 LOG(INFO) << "Wrote expectations to: " | 387 LOG(INFO) << "Wrote expectations to: " |
371 << expected_file.LossyDisplayName(); | 388 << expected_file.LossyDisplayName(); |
372 } | 389 } |
373 } else { | 390 } else { |
374 LOG(INFO) << "Test output matches expectations."; | 391 LOG(INFO) << "Test output matches expectations."; |
375 } | 392 } |
376 } | 393 } |
377 | 394 |
378 } // namespace content | 395 } // namespace content |
OLD | NEW |