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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/shared_memory.h" | 8 #include "base/memory/shared_memory.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 using blink::WebMouseEvent; | 75 using blink::WebMouseEvent; |
76 using blink::WebRuntimeFeatures; | 76 using blink::WebRuntimeFeatures; |
77 using blink::WebString; | 77 using blink::WebString; |
78 using blink::WebTextDirection; | 78 using blink::WebTextDirection; |
79 using blink::WebURLError; | 79 using blink::WebURLError; |
80 | 80 |
81 namespace content { | 81 namespace content { |
82 | 82 |
83 namespace { | 83 namespace { |
84 | 84 |
| 85 static const int kProxyRoutingId = 13; |
| 86 |
85 #if (defined(USE_AURA) && defined(USE_X11)) || defined(USE_OZONE) | 87 #if (defined(USE_AURA) && defined(USE_X11)) || defined(USE_OZONE) |
86 // Converts MockKeyboard::Modifiers to ui::EventFlags. | 88 // Converts MockKeyboard::Modifiers to ui::EventFlags. |
87 int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) { | 89 int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) { |
88 static struct ModifierMap { | 90 static struct ModifierMap { |
89 MockKeyboard::Modifiers src; | 91 MockKeyboard::Modifiers src; |
90 int dst; | 92 int dst; |
91 } kModifierMap[] = { | 93 } kModifierMap[] = { |
92 { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, | 94 { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, |
93 { MockKeyboard::RIGHT_SHIFT, ui::EF_SHIFT_DOWN }, | 95 { MockKeyboard::RIGHT_SHIFT, ui::EF_SHIFT_DOWN }, |
94 { MockKeyboard::LEFT_CONTROL, ui::EF_CONTROL_DOWN }, | 96 { MockKeyboard::LEFT_CONTROL, ui::EF_CONTROL_DOWN }, |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 new_view->Release(); | 483 new_view->Release(); |
482 } | 484 } |
483 | 485 |
484 // Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is | 486 // Ensure the RenderViewImpl sends an ACK to a SwapOut request, even if it is |
485 // already swapped out. http://crbug.com/93427. | 487 // already swapped out. http://crbug.com/93427. |
486 TEST_F(RenderViewImplTest, SendSwapOutACK) { | 488 TEST_F(RenderViewImplTest, SendSwapOutACK) { |
487 LoadHTML("<div>Page A</div>"); | 489 LoadHTML("<div>Page A</div>"); |
488 int initial_page_id = view()->GetPageId(); | 490 int initial_page_id = view()->GetPageId(); |
489 | 491 |
490 // Respond to a swap out request. | 492 // Respond to a swap out request. |
491 view()->main_render_frame()->OnSwapOut(); | 493 view()->main_render_frame()->OnSwapOut(kProxyRoutingId); |
492 | 494 |
493 // Ensure the swap out commits synchronously. | 495 // Ensure the swap out commits synchronously. |
494 EXPECT_NE(initial_page_id, view()->GetPageId()); | 496 EXPECT_NE(initial_page_id, view()->GetPageId()); |
495 | 497 |
496 // Check for a valid OnSwapOutACK. | 498 // Check for a valid OnSwapOutACK. |
497 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( | 499 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( |
498 FrameHostMsg_SwapOut_ACK::ID); | 500 FrameHostMsg_SwapOut_ACK::ID); |
499 ASSERT_TRUE(msg); | 501 ASSERT_TRUE(msg); |
500 | 502 |
501 // It is possible to get another swap out request. Ensure that we send | 503 // It is possible to get another swap out request. Ensure that we send |
502 // an ACK, even if we don't have to do anything else. | 504 // an ACK, even if we don't have to do anything else. |
503 render_thread_->sink().ClearMessages(); | 505 render_thread_->sink().ClearMessages(); |
504 view()->main_render_frame()->OnSwapOut(); | 506 view()->main_render_frame()->OnSwapOut(kProxyRoutingId); |
505 const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching( | 507 const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching( |
506 FrameHostMsg_SwapOut_ACK::ID); | 508 FrameHostMsg_SwapOut_ACK::ID); |
507 ASSERT_TRUE(msg2); | 509 ASSERT_TRUE(msg2); |
508 | 510 |
509 // If we navigate back to this RenderView, ensure we don't send a state | 511 // If we navigate back to this RenderView, ensure we don't send a state |
510 // update for the swapped out URL. (http://crbug.com/72235) | 512 // update for the swapped out URL. (http://crbug.com/72235) |
511 FrameMsg_Navigate_Params nav_params; | 513 FrameMsg_Navigate_Params nav_params; |
512 nav_params.url = GURL("data:text/html,<div>Page B</div>"); | 514 nav_params.url = GURL("data:text/html,<div>Page B</div>"); |
513 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 515 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
514 nav_params.transition = PAGE_TRANSITION_TYPED; | 516 nav_params.transition = PAGE_TRANSITION_TYPED; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 params_A.transition = PAGE_TRANSITION_FORWARD_BACK; | 552 params_A.transition = PAGE_TRANSITION_FORWARD_BACK; |
551 params_A.current_history_list_length = 2; | 553 params_A.current_history_list_length = 2; |
552 params_A.current_history_list_offset = 1; | 554 params_A.current_history_list_offset = 1; |
553 params_A.pending_history_list_offset = 0; | 555 params_A.pending_history_list_offset = 0; |
554 params_A.page_id = 1; | 556 params_A.page_id = 1; |
555 params_A.page_state = state_A; | 557 params_A.page_state = state_A; |
556 frame()->OnNavigate(params_A); | 558 frame()->OnNavigate(params_A); |
557 ProcessPendingMessages(); | 559 ProcessPendingMessages(); |
558 | 560 |
559 // Respond to a swap out request. | 561 // Respond to a swap out request. |
560 view()->main_render_frame()->OnSwapOut(); | 562 view()->main_render_frame()->OnSwapOut(kProxyRoutingId); |
561 | 563 |
562 // Check for a OnSwapOutACK. | 564 // Check for a OnSwapOutACK. |
563 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( | 565 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( |
564 FrameHostMsg_SwapOut_ACK::ID); | 566 FrameHostMsg_SwapOut_ACK::ID); |
565 ASSERT_TRUE(msg); | 567 ASSERT_TRUE(msg); |
566 render_thread_->sink().ClearMessages(); | 568 render_thread_->sink().ClearMessages(); |
567 | 569 |
568 // It is possible to get a reload request at this point, containing the | 570 // It is possible to get a reload request at this point, containing the |
569 // params.page_state of the initial page (e.g., if the new page fails the | 571 // params.page_state of the initial page (e.g., if the new page fails the |
570 // provisional load in the renderer process, after we unload the old page). | 572 // provisional load in the renderer process, after we unload the old page). |
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2365 view()->renderer_accessibility()->GetType()); | 2367 view()->renderer_accessibility()->GetType()); |
2366 | 2368 |
2367 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly); | 2369 view()->OnSetAccessibilityMode(AccessibilityModeEditableTextOnly); |
2368 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode()); | 2370 ASSERT_EQ(AccessibilityModeEditableTextOnly, view()->accessibility_mode()); |
2369 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility()); | 2371 ASSERT_NE((RendererAccessibility*) NULL, view()->renderer_accessibility()); |
2370 ASSERT_EQ(RendererAccessibilityTypeFocusOnly, | 2372 ASSERT_EQ(RendererAccessibilityTypeFocusOnly, |
2371 view()->renderer_accessibility()->GetType()); | 2373 view()->renderer_accessibility()->GetType()); |
2372 } | 2374 } |
2373 | 2375 |
2374 } // namespace content | 2376 } // namespace content |
OLD | NEW |