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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "base/time/time.h" | 6 #include "base/time/time.h" |
7 #include "content/common/frame_messages.h" | 7 #include "content/common/frame_messages.h" |
8 #include "content/common/view_message_enums.h" | 8 #include "content/common/view_message_enums.h" |
9 #include "content/public/test/render_view_test.h" | 9 #include "content/public/test/render_view_test.h" |
10 #include "content/renderer/accessibility/renderer_accessibility.h" | 10 #include "content/renderer/accessibility/renderer_accessibility.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 accessibility->SendPendingAccessibilityEvents(); | 183 accessibility->SendPendingAccessibilityEvents(); |
184 EXPECT_FALSE(sink_->GetUniqueMessageMatching( | 184 EXPECT_FALSE(sink_->GetUniqueMessageMatching( |
185 AccessibilityHostMsg_Events::ID)); | 185 AccessibilityHostMsg_Events::ID)); |
186 | 186 |
187 // Navigate, so we're not swapped out anymore. Now we should | 187 // Navigate, so we're not swapped out anymore. Now we should |
188 // send accessibility events again. Note that the | 188 // send accessibility events again. Note that the |
189 // message that was queued up before will be quickly discarded | 189 // message that was queued up before will be quickly discarded |
190 // because the element it was referring to no longer exists, | 190 // because the element it was referring to no longer exists, |
191 // so the event here is from loading this new page. | 191 // so the event here is from loading this new page. |
192 CommonNavigationParams common_params; | 192 CommonNavigationParams common_params; |
193 HistoryNavigationParams history_params; | 193 RequestNavigationParams request_params; |
194 common_params.url = GURL("data:text/html,<p>Hello, again.</p>"); | 194 common_params.url = GURL("data:text/html,<p>Hello, again.</p>"); |
195 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 195 common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
196 common_params.transition = ui::PAGE_TRANSITION_TYPED; | 196 common_params.transition = ui::PAGE_TRANSITION_TYPED; |
197 history_params.current_history_list_length = 1; | 197 request_params.current_history_list_length = 1; |
198 history_params.current_history_list_offset = 0; | 198 request_params.current_history_list_offset = 0; |
199 history_params.pending_history_list_offset = 1; | 199 request_params.pending_history_list_offset = 1; |
200 history_params.page_id = -1; | 200 request_params.page_id = -1; |
201 frame()->OnNavigate(common_params, StartNavigationParams(), | 201 frame()->OnNavigate(common_params, StartNavigationParams(), request_params); |
202 CommitNavigationParams(), history_params); | |
203 accessibility->SendPendingAccessibilityEvents(); | 202 accessibility->SendPendingAccessibilityEvents(); |
204 EXPECT_TRUE(sink_->GetUniqueMessageMatching( | 203 EXPECT_TRUE(sink_->GetUniqueMessageMatching( |
205 AccessibilityHostMsg_Events::ID)); | 204 AccessibilityHostMsg_Events::ID)); |
206 } | 205 } |
207 | 206 |
208 TEST_F(RendererAccessibilityTest, HideAccessibilityObject) { | 207 TEST_F(RendererAccessibilityTest, HideAccessibilityObject) { |
209 // Test RendererAccessibility and make sure it sends the | 208 // Test RendererAccessibility and make sure it sends the |
210 // proper event to the browser when an object in the tree | 209 // proper event to the browser when an object in the tree |
211 // is hidden, but its children are not. | 210 // is hidden, but its children are not. |
212 std::string html = | 211 std::string html = |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 403 |
405 const IPC::Message* message = | 404 const IPC::Message* message = |
406 sink_->GetUniqueMessageMatching(AccessibilityHostMsg_Events::ID); | 405 sink_->GetUniqueMessageMatching(AccessibilityHostMsg_Events::ID); |
407 ASSERT_TRUE(message); | 406 ASSERT_TRUE(message); |
408 Tuple<std::vector<AccessibilityHostMsg_EventParams>, int> param; | 407 Tuple<std::vector<AccessibilityHostMsg_EventParams>, int> param; |
409 AccessibilityHostMsg_Events::Read(message, ¶m); | 408 AccessibilityHostMsg_Events::Read(message, ¶m); |
410 ASSERT_EQ(0U, get<0>(param).size()); | 409 ASSERT_EQ(0U, get<0>(param).size()); |
411 } | 410 } |
412 | 411 |
413 } // namespace content | 412 } // namespace content |
OLD | NEW |