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

Side by Side Diff: content/browser/accessibility/accessibility_ipc_error_browsertest.cc

Issue 2052633002: Extend the ToRenderFrameHost magic to FrameTreeNode* and Shell* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix induced script bug. Created 4 years, 6 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/browser/frame_host/render_frame_host_impl.h" 9 #include "content/browser/frame_host/render_frame_host_impl.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 frame->set_no_create_browser_accessibility_manager_for_testing(false); 79 frame->set_no_create_browser_accessibility_manager_for_testing(false);
80 ASSERT_TRUE(frame->GetOrCreateBrowserAccessibilityManager() != nullptr); 80 ASSERT_TRUE(frame->GetOrCreateBrowserAccessibilityManager() != nullptr);
81 frame->set_no_create_browser_accessibility_manager_for_testing(true); 81 frame->set_no_create_browser_accessibility_manager_for_testing(true);
82 82
83 { 83 {
84 // Hide one of the elements on the page, and wait for an accessibility 84 // Hide one of the elements on the page, and wait for an accessibility
85 // notification triggered by the hide. 85 // notification triggered by the hide.
86 AccessibilityNotificationWaiter waiter( 86 AccessibilityNotificationWaiter waiter(
87 shell(), AccessibilityModeComplete, ui::AX_EVENT_LIVE_REGION_CHANGED); 87 shell(), AccessibilityModeComplete, ui::AX_EVENT_LIVE_REGION_CHANGED);
88 ASSERT_TRUE(ExecuteScript( 88 ASSERT_TRUE(ExecuteScript(
89 shell()->web_contents(), 89 shell(), "document.getElementById('p1').style.display = 'none';"));
90 "document.getElementById('p1').style.display = 'none';"));
91 waiter.WaitForNotification(); 90 waiter.WaitForNotification();
92 } 91 }
93 92
94 // Show that accessibility was reset because the frame doesn't have a 93 // Show that accessibility was reset because the frame doesn't have a
95 // BrowserAccessibilityManager anymore. 94 // BrowserAccessibilityManager anymore.
96 ASSERT_EQ(nullptr, frame->browser_accessibility_manager()); 95 ASSERT_EQ(nullptr, frame->browser_accessibility_manager());
97 96
98 // Finally, allow creating a new accessibility manager and 97 // Finally, allow creating a new accessibility manager and
99 // ensure that we didn't kill the renderer; we can still send it messages. 98 // ensure that we didn't kill the renderer; we can still send it messages.
100 frame->set_no_create_browser_accessibility_manager_for_testing(false); 99 frame->set_no_create_browser_accessibility_manager_for_testing(false);
101 const ui::AXTree* tree = nullptr; 100 const ui::AXTree* tree = nullptr;
102 { 101 {
103 AccessibilityNotificationWaiter waiter( 102 AccessibilityNotificationWaiter waiter(
104 shell(), AccessibilityModeComplete, ui::AX_EVENT_FOCUS); 103 shell(), AccessibilityModeComplete, ui::AX_EVENT_FOCUS);
105 ASSERT_TRUE(ExecuteScript( 104 ASSERT_TRUE(
106 shell()->web_contents(), 105 ExecuteScript(shell(), "document.getElementById('button').focus();"));
107 "document.getElementById('button').focus();"));
108 waiter.WaitForNotification(); 106 waiter.WaitForNotification();
109 tree = &waiter.GetAXTree(); 107 tree = &waiter.GetAXTree();
110 } 108 }
111 109
112 // Get the accessibility tree, ensure it reflects the final state of the 110 // Get the accessibility tree, ensure it reflects the final state of the
113 // document. 111 // document.
114 const ui::AXNode* root = tree->root(); 112 const ui::AXNode* root = tree->root();
115 113
116 // Use this for debugging if the test fails. 114 // Use this for debugging if the test fails.
117 VLOG(1) << tree->ToString(); 115 VLOG(1) << tree->ToString();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Wait for the renderer to be killed. 189 // Wait for the renderer to be killed.
192 if (frame->IsRenderFrameLive()) { 190 if (frame->IsRenderFrameLive()) {
193 RenderProcessHostWatcher render_process_watcher( 191 RenderProcessHostWatcher render_process_watcher(
194 frame->GetProcess(), RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 192 frame->GetProcess(), RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
195 render_process_watcher.Wait(); 193 render_process_watcher.Wait();
196 } 194 }
197 ASSERT_FALSE(frame->IsRenderFrameLive()); 195 ASSERT_FALSE(frame->IsRenderFrameLive());
198 } 196 }
199 197
200 } // namespace content 198 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/bookmarklet_browsertest.cc » ('j') | content/public/test/content_browser_test_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698