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

Side by Side Diff: content/renderer/accessibility/renderer_accessibility_browsertest.cc

Issue 1785153005: Remove SiteIsolationPolicy::IsSwappedOutStateForbidden(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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) 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "content/common/accessibility_messages.h" 9 #include "content/common/accessibility_messages.h"
10 #include "content/common/frame_messages.h" 10 #include "content/common/frame_messages.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser()); 166 EXPECT_EQ(4, CountAccessibilityNodesSentToBrowser());
167 } 167 }
168 168
169 // http://crbug.com/253537 169 // http://crbug.com/253537
170 #if defined(OS_ANDROID) 170 #if defined(OS_ANDROID)
171 #define MAYBE_AccessibilityMessagesQueueWhileSwappedOut \ 171 #define MAYBE_AccessibilityMessagesQueueWhileSwappedOut \
172 DISABLED_AccessibilityMessagesQueueWhileSwappedOut 172 DISABLED_AccessibilityMessagesQueueWhileSwappedOut
173 #else 173 #else
174 #define MAYBE_AccessibilityMessagesQueueWhileSwappedOut \ 174 #define MAYBE_AccessibilityMessagesQueueWhileSwappedOut \
175 AccessibilityMessagesQueueWhileSwappedOut 175 AccessibilityMessagesQueueWhileSwappedOut
176 #endif 176 #endif
Charlie Reis 2016/03/11 21:56:56 Delete this stuff too, and we can close http://crb
nasko 2016/03/11 22:35:33 Done.
177 177
178 TEST_F(RendererAccessibilityTest,
179 MAYBE_AccessibilityMessagesQueueWhileSwappedOut) {
180 // This test breaks down in --site-per-process, as swapping out destroys
181 // the main frame and it cannot be further navigated.
182 // TODO(nasko): Figure out what this behavior looks like when swapped out
183 // no longer exists.
184 if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) {
185 return;
186 }
187 std::string html =
188 "<body>"
189 " <p>Hello, world.</p>"
190 "</body>";
191 LoadHTML(html.c_str());
192 static const int kProxyRoutingId = 13;
193
194 // Creating a RendererAccessibility should send the tree to the browser.
195 scoped_ptr<TestRendererAccessibility> accessibility(
196 new TestRendererAccessibility(frame()));
197 accessibility->SendPendingAccessibilityEvents();
198 EXPECT_EQ(5, CountAccessibilityNodesSentToBrowser());
199
200 // Post a "value changed" event, but then swap out
201 // before sending it. It shouldn't send the event while
202 // swapped out.
203 sink_->ClearMessages();
204 WebDocument document = view()->GetWebView()->mainFrame()->document();
205 WebAXObject root_obj = document.accessibilityObject();
206 accessibility->HandleAXEvent(
207 root_obj,
208 ui::AX_EVENT_VALUE_CHANGED);
209 view()->GetMainRenderFrame()->OnSwapOut(kProxyRoutingId, true,
210 content::FrameReplicationState());
211 accessibility->SendPendingAccessibilityEvents();
212 EXPECT_FALSE(sink_->GetUniqueMessageMatching(
213 AccessibilityHostMsg_Events::ID));
214
215 // Navigate, so we're not swapped out anymore. Now we should
216 // send accessibility events again. Note that the
217 // message that was queued up before will be quickly discarded
218 // because the element it was referring to no longer exists,
219 // so the event here is from loading this new page.
220 CommonNavigationParams common_params;
221 RequestNavigationParams request_params;
222 common_params.url = GURL("data:text/html,<p>Hello, again.</p>");
223 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
224 common_params.transition = ui::PAGE_TRANSITION_TYPED;
225 request_params.current_history_list_length = 1;
226 request_params.current_history_list_offset = 0;
227 request_params.pending_history_list_offset = 1;
228 request_params.page_id = -1;
229 frame()->OnNavigate(common_params, StartNavigationParams(), request_params);
230 accessibility->SendPendingAccessibilityEvents();
231 EXPECT_TRUE(sink_->GetUniqueMessageMatching(
232 AccessibilityHostMsg_Events::ID));
233 }
234
235 TEST_F(RendererAccessibilityTest, HideAccessibilityObject) { 178 TEST_F(RendererAccessibilityTest, HideAccessibilityObject) {
236 // Test RendererAccessibility and make sure it sends the 179 // Test RendererAccessibility and make sure it sends the
237 // proper event to the browser when an object in the tree 180 // proper event to the browser when an object in the tree
238 // is hidden, but its children are not. 181 // is hidden, but its children are not.
239 std::string html = 182 std::string html =
240 "<body>" 183 "<body>"
241 " <div role='group' id='A'>" 184 " <div role='group' id='A'>"
242 " <div role='group' id='B'>" 185 " <div role='group' id='B'>"
243 " <div role='group' id='C' style='visibility:visible'>" 186 " <div role='group' id='C' style='visibility:visible'>"
244 " </div>" 187 " </div>"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 GetLastAccEvent(&event); 340 GetLastAccEvent(&event);
398 ASSERT_EQ(5U, event.update.nodes.size()); 341 ASSERT_EQ(5U, event.update.nodes.size());
399 342
400 EXPECT_EQ(body.axID(), event.update.nodes[0].id); 343 EXPECT_EQ(body.axID(), event.update.nodes[0].id);
401 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id); 344 EXPECT_EQ(text_1.axID(), event.update.nodes[1].id);
402 // The third event is to update text_2, but its id changes 345 // The third event is to update text_2, but its id changes
403 // so we don't have a test expectation for it. 346 // so we don't have a test expectation for it.
404 } 347 }
405 348
406 } // namespace content 349 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698