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 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 ExecuteJavaScript("document.getElementById('elt_text').value = 'foo';"); | 356 ExecuteJavaScript("document.getElementById('elt_text').value = 'foo';"); |
357 ProcessPendingMessages(); | 357 ProcessPendingMessages(); |
358 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 358 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
359 ViewHostMsg_UpdateState::ID)); | 359 ViewHostMsg_UpdateState::ID)); |
360 } | 360 } |
361 | 361 |
362 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { | 362 TEST_F(RenderViewImplTest, OnNavigationHttpPost) { |
363 FrameMsg_Navigate_Params nav_params; | 363 FrameMsg_Navigate_Params nav_params; |
364 | 364 |
365 // An http url will trigger a resource load so cannot be used here. | 365 // An http url will trigger a resource load so cannot be used here. |
366 nav_params.url = GURL("data:text/html,<div>Page</div>"); | 366 nav_params.core_params.url = GURL("data:text/html,<div>Page</div>"); |
367 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 367 nav_params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
368 nav_params.transition = ui::PAGE_TRANSITION_TYPED; | 368 nav_params.core_params.transition = ui::PAGE_TRANSITION_TYPED; |
369 nav_params.page_id = -1; | 369 nav_params.page_id = -1; |
370 nav_params.is_post = true; | 370 nav_params.request_params.is_post = true; |
371 nav_params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 371 nav_params.commit_params.browser_navigation_start = |
| 372 base::TimeTicks::FromInternalValue(1); |
372 | 373 |
373 // Set up post data. | 374 // Set up post data. |
374 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( | 375 const unsigned char* raw_data = reinterpret_cast<const unsigned char*>( |
375 "post \0\ndata"); | 376 "post \0\ndata"); |
376 const unsigned int length = 11; | 377 const unsigned int length = 11; |
377 const std::vector<unsigned char> post_data(raw_data, raw_data + length); | 378 const std::vector<unsigned char> post_data(raw_data, raw_data + length); |
378 nav_params.browser_initiated_post_data = post_data; | 379 nav_params.request_params.browser_initiated_post_data = post_data; |
379 | 380 |
380 frame()->OnNavigate(nav_params); | 381 frame()->OnNavigate(nav_params); |
381 ProcessPendingMessages(); | 382 ProcessPendingMessages(); |
382 | 383 |
383 const IPC::Message* frame_navigate_msg = | 384 const IPC::Message* frame_navigate_msg = |
384 render_thread_->sink().GetUniqueMessageMatching( | 385 render_thread_->sink().GetUniqueMessageMatching( |
385 FrameHostMsg_DidCommitProvisionalLoad::ID); | 386 FrameHostMsg_DidCommitProvisionalLoad::ID); |
386 EXPECT_TRUE(frame_navigate_msg); | 387 EXPECT_TRUE(frame_navigate_msg); |
387 | 388 |
388 FrameHostMsg_DidCommitProvisionalLoad::Param host_nav_params; | 389 FrameHostMsg_DidCommitProvisionalLoad::Param host_nav_params; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 // an ACK, even if we don't have to do anything else. | 562 // an ACK, even if we don't have to do anything else. |
562 render_thread_->sink().ClearMessages(); | 563 render_thread_->sink().ClearMessages(); |
563 view()->GetMainRenderFrame()->OnSwapOut(kProxyRoutingId); | 564 view()->GetMainRenderFrame()->OnSwapOut(kProxyRoutingId); |
564 const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching( | 565 const IPC::Message* msg2 = render_thread_->sink().GetUniqueMessageMatching( |
565 FrameHostMsg_SwapOut_ACK::ID); | 566 FrameHostMsg_SwapOut_ACK::ID); |
566 ASSERT_TRUE(msg2); | 567 ASSERT_TRUE(msg2); |
567 | 568 |
568 // If we navigate back to this RenderView, ensure we don't send a state | 569 // If we navigate back to this RenderView, ensure we don't send a state |
569 // update for the swapped out URL. (http://crbug.com/72235) | 570 // update for the swapped out URL. (http://crbug.com/72235) |
570 FrameMsg_Navigate_Params nav_params; | 571 FrameMsg_Navigate_Params nav_params; |
571 nav_params.url = GURL("data:text/html,<div>Page B</div>"); | 572 nav_params.core_params.url = GURL("data:text/html,<div>Page B</div>"); |
572 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 573 nav_params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
573 nav_params.transition = ui::PAGE_TRANSITION_TYPED; | 574 nav_params.core_params.transition = ui::PAGE_TRANSITION_TYPED; |
574 nav_params.current_history_list_length = 1; | 575 nav_params.current_history_list_length = 1; |
575 nav_params.current_history_list_offset = 0; | 576 nav_params.current_history_list_offset = 0; |
576 nav_params.pending_history_list_offset = 1; | 577 nav_params.pending_history_list_offset = 1; |
577 nav_params.page_id = -1; | 578 nav_params.page_id = -1; |
578 nav_params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 579 nav_params.commit_params.browser_navigation_start = |
| 580 base::TimeTicks::FromInternalValue(1); |
579 frame()->OnNavigate(nav_params); | 581 frame()->OnNavigate(nav_params); |
580 ProcessPendingMessages(); | 582 ProcessPendingMessages(); |
581 const IPC::Message* msg3 = render_thread_->sink().GetUniqueMessageMatching( | 583 const IPC::Message* msg3 = render_thread_->sink().GetUniqueMessageMatching( |
582 ViewHostMsg_UpdateState::ID); | 584 ViewHostMsg_UpdateState::ID); |
583 EXPECT_FALSE(msg3); | 585 EXPECT_FALSE(msg3); |
584 } | 586 } |
585 | 587 |
586 // Ensure the RenderViewImpl reloads the previous page if a reload request | 588 // Ensure the RenderViewImpl reloads the previous page if a reload request |
587 // arrives while it is showing swappedout://. http://crbug.com/143155. | 589 // arrives while it is showing swappedout://. http://crbug.com/143155. |
588 TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { | 590 TEST_F(RenderViewImplTest, ReloadWhileSwappedOut) { |
(...skipping 10 matching lines...) Expand all Loading... |
599 ASSERT_TRUE(msg_A); | 601 ASSERT_TRUE(msg_A); |
600 ViewHostMsg_UpdateState::Param params; | 602 ViewHostMsg_UpdateState::Param params; |
601 ViewHostMsg_UpdateState::Read(msg_A, ¶ms); | 603 ViewHostMsg_UpdateState::Read(msg_A, ¶ms); |
602 int page_id_A = params.a; | 604 int page_id_A = params.a; |
603 PageState state_A = params.b; | 605 PageState state_A = params.b; |
604 EXPECT_EQ(1, page_id_A); | 606 EXPECT_EQ(1, page_id_A); |
605 render_thread_->sink().ClearMessages(); | 607 render_thread_->sink().ClearMessages(); |
606 | 608 |
607 // Back to page A (page_id 1) and commit. | 609 // Back to page A (page_id 1) and commit. |
608 FrameMsg_Navigate_Params params_A; | 610 FrameMsg_Navigate_Params params_A; |
609 params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 611 params_A.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
610 params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 612 params_A.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
611 params_A.current_history_list_length = 2; | 613 params_A.current_history_list_length = 2; |
612 params_A.current_history_list_offset = 1; | 614 params_A.current_history_list_offset = 1; |
613 params_A.pending_history_list_offset = 0; | 615 params_A.pending_history_list_offset = 0; |
614 params_A.page_id = 1; | 616 params_A.page_id = 1; |
615 params_A.page_state = state_A; | 617 params_A.commit_params.page_state = state_A; |
616 params_A.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 618 params_A.commit_params.browser_navigation_start = |
| 619 base::TimeTicks::FromInternalValue(1); |
617 frame()->OnNavigate(params_A); | 620 frame()->OnNavigate(params_A); |
618 ProcessPendingMessages(); | 621 ProcessPendingMessages(); |
619 | 622 |
620 // Respond to a swap out request. | 623 // Respond to a swap out request. |
621 view()->GetMainRenderFrame()->OnSwapOut(kProxyRoutingId); | 624 view()->GetMainRenderFrame()->OnSwapOut(kProxyRoutingId); |
622 | 625 |
623 // Check for a OnSwapOutACK. | 626 // Check for a OnSwapOutACK. |
624 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( | 627 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( |
625 FrameHostMsg_SwapOut_ACK::ID); | 628 FrameHostMsg_SwapOut_ACK::ID); |
626 ASSERT_TRUE(msg); | 629 ASSERT_TRUE(msg); |
627 render_thread_->sink().ClearMessages(); | 630 render_thread_->sink().ClearMessages(); |
628 | 631 |
629 // It is possible to get a reload request at this point, containing the | 632 // It is possible to get a reload request at this point, containing the |
630 // params.page_state of the initial page (e.g., if the new page fails the | 633 // params.page_state of the initial page (e.g., if the new page fails the |
631 // provisional load in the renderer process, after we unload the old page). | 634 // provisional load in the renderer process, after we unload the old page). |
632 // Ensure the old page gets reloaded, not swappedout://. | 635 // Ensure the old page gets reloaded, not swappedout://. |
633 FrameMsg_Navigate_Params nav_params; | 636 FrameMsg_Navigate_Params nav_params; |
634 nav_params.url = GURL("data:text/html,<div>Page A</div>"); | 637 nav_params.core_params.url = GURL("data:text/html,<div>Page A</div>"); |
635 nav_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; | 638 nav_params.core_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; |
636 nav_params.transition = ui::PAGE_TRANSITION_RELOAD; | 639 nav_params.core_params.transition = ui::PAGE_TRANSITION_RELOAD; |
637 nav_params.current_history_list_length = 2; | 640 nav_params.current_history_list_length = 2; |
638 nav_params.current_history_list_offset = 0; | 641 nav_params.current_history_list_offset = 0; |
639 nav_params.pending_history_list_offset = 0; | 642 nav_params.pending_history_list_offset = 0; |
640 nav_params.page_id = 1; | 643 nav_params.page_id = 1; |
641 nav_params.page_state = state_A; | 644 nav_params.commit_params.page_state = state_A; |
642 nav_params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 645 nav_params.commit_params.browser_navigation_start = |
| 646 base::TimeTicks::FromInternalValue(1); |
643 frame()->OnNavigate(nav_params); | 647 frame()->OnNavigate(nav_params); |
644 ProcessPendingMessages(); | 648 ProcessPendingMessages(); |
645 | 649 |
646 // Verify page A committed, not swappedout://. | 650 // Verify page A committed, not swappedout://. |
647 const IPC::Message* frame_navigate_msg = | 651 const IPC::Message* frame_navigate_msg = |
648 render_thread_->sink().GetUniqueMessageMatching( | 652 render_thread_->sink().GetUniqueMessageMatching( |
649 FrameHostMsg_DidCommitProvisionalLoad::ID); | 653 FrameHostMsg_DidCommitProvisionalLoad::ID); |
650 EXPECT_TRUE(frame_navigate_msg); | 654 EXPECT_TRUE(frame_navigate_msg); |
651 | 655 |
652 // Read URL out of the parent trait of the params object. | 656 // Read URL out of the parent trait of the params object. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 ASSERT_TRUE(msg_C); | 708 ASSERT_TRUE(msg_C); |
705 ViewHostMsg_UpdateState::Read(msg_C, ¶m); | 709 ViewHostMsg_UpdateState::Read(msg_C, ¶m); |
706 int page_id_C = param.a; | 710 int page_id_C = param.a; |
707 PageState state_C = param.b; | 711 PageState state_C = param.b; |
708 EXPECT_EQ(3, page_id_C); | 712 EXPECT_EQ(3, page_id_C); |
709 EXPECT_NE(state_B, state_C); | 713 EXPECT_NE(state_B, state_C); |
710 render_thread_->sink().ClearMessages(); | 714 render_thread_->sink().ClearMessages(); |
711 | 715 |
712 // Go back to C and commit, preparing for our real test. | 716 // Go back to C and commit, preparing for our real test. |
713 FrameMsg_Navigate_Params params_C; | 717 FrameMsg_Navigate_Params params_C; |
714 params_C.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 718 params_C.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
715 params_C.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 719 params_C.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
716 params_C.current_history_list_length = 4; | 720 params_C.current_history_list_length = 4; |
717 params_C.current_history_list_offset = 3; | 721 params_C.current_history_list_offset = 3; |
718 params_C.pending_history_list_offset = 2; | 722 params_C.pending_history_list_offset = 2; |
719 params_C.page_id = 3; | 723 params_C.page_id = 3; |
720 params_C.page_state = state_C; | 724 params_C.commit_params.page_state = state_C; |
721 params_C.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 725 params_C.commit_params.browser_navigation_start = |
| 726 base::TimeTicks::FromInternalValue(1); |
722 frame()->OnNavigate(params_C); | 727 frame()->OnNavigate(params_C); |
723 ProcessPendingMessages(); | 728 ProcessPendingMessages(); |
724 render_thread_->sink().ClearMessages(); | 729 render_thread_->sink().ClearMessages(); |
725 | 730 |
726 // Go back twice quickly, such that page B does not have a chance to commit. | 731 // Go back twice quickly, such that page B does not have a chance to commit. |
727 // This leads to two changes to the back/forward list but only one change to | 732 // This leads to two changes to the back/forward list but only one change to |
728 // the RenderView's page ID. | 733 // the RenderView's page ID. |
729 | 734 |
730 // Back to page B (page_id 2), without committing. | 735 // Back to page B (page_id 2), without committing. |
731 FrameMsg_Navigate_Params params_B; | 736 FrameMsg_Navigate_Params params_B; |
732 params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 737 params_B.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
733 params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 738 params_B.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
734 params_B.current_history_list_length = 4; | 739 params_B.current_history_list_length = 4; |
735 params_B.current_history_list_offset = 2; | 740 params_B.current_history_list_offset = 2; |
736 params_B.pending_history_list_offset = 1; | 741 params_B.pending_history_list_offset = 1; |
737 params_B.page_id = 2; | 742 params_B.page_id = 2; |
738 params_B.page_state = state_B; | 743 params_B.commit_params.page_state = state_B; |
739 params_B.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 744 params_B.commit_params.browser_navigation_start = |
| 745 base::TimeTicks::FromInternalValue(1); |
740 frame()->OnNavigate(params_B); | 746 frame()->OnNavigate(params_B); |
741 | 747 |
742 // Back to page A (page_id 1) and commit. | 748 // Back to page A (page_id 1) and commit. |
743 FrameMsg_Navigate_Params params; | 749 FrameMsg_Navigate_Params params; |
744 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 750 params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
745 params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 751 params.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
746 params_B.current_history_list_length = 4; | 752 params_B.current_history_list_length = 4; |
747 params_B.current_history_list_offset = 2; | 753 params_B.current_history_list_offset = 2; |
748 params_B.pending_history_list_offset = 0; | 754 params_B.pending_history_list_offset = 0; |
749 params.page_id = 1; | 755 params.page_id = 1; |
750 params.page_state = state_A; | 756 params.commit_params.page_state = state_A; |
751 params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 757 params.commit_params.browser_navigation_start = |
| 758 base::TimeTicks::FromInternalValue(1); |
752 frame()->OnNavigate(params); | 759 frame()->OnNavigate(params); |
753 ProcessPendingMessages(); | 760 ProcessPendingMessages(); |
754 | 761 |
755 // Now ensure that the UpdateState message we receive is consistent | 762 // Now ensure that the UpdateState message we receive is consistent |
756 // and represents page C in both page_id and state. | 763 // and represents page C in both page_id and state. |
757 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( | 764 const IPC::Message* msg = render_thread_->sink().GetUniqueMessageMatching( |
758 ViewHostMsg_UpdateState::ID); | 765 ViewHostMsg_UpdateState::ID); |
759 ASSERT_TRUE(msg); | 766 ASSERT_TRUE(msg); |
760 ViewHostMsg_UpdateState::Read(msg, ¶m); | 767 ViewHostMsg_UpdateState::Read(msg, ¶m); |
761 int page_id = param.a; | 768 int page_id = param.a; |
(...skipping 27 matching lines...) Expand all Loading... |
789 ASSERT_TRUE(msg_A); | 796 ASSERT_TRUE(msg_A); |
790 ViewHostMsg_UpdateState::Param param; | 797 ViewHostMsg_UpdateState::Param param; |
791 ViewHostMsg_UpdateState::Read(msg_A, ¶m); | 798 ViewHostMsg_UpdateState::Read(msg_A, ¶m); |
792 int page_id_A = param.a; | 799 int page_id_A = param.a; |
793 PageState state_A = param.b; | 800 PageState state_A = param.b; |
794 EXPECT_EQ(1, page_id_A); | 801 EXPECT_EQ(1, page_id_A); |
795 render_thread_->sink().ClearMessages(); | 802 render_thread_->sink().ClearMessages(); |
796 | 803 |
797 // Back to page A (page_id 1) and commit. | 804 // Back to page A (page_id 1) and commit. |
798 FrameMsg_Navigate_Params params_A; | 805 FrameMsg_Navigate_Params params_A; |
799 params_A.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 806 params_A.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
800 params_A.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 807 params_A.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
801 params_A.current_history_list_length = 2; | 808 params_A.current_history_list_length = 2; |
802 params_A.current_history_list_offset = 1; | 809 params_A.current_history_list_offset = 1; |
803 params_A.pending_history_list_offset = 0; | 810 params_A.pending_history_list_offset = 0; |
804 params_A.page_id = 1; | 811 params_A.page_id = 1; |
805 params_A.page_state = state_A; | 812 params_A.commit_params.page_state = state_A; |
806 params_A.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 813 params_A.commit_params.browser_navigation_start = |
| 814 base::TimeTicks::FromInternalValue(1); |
807 frame()->OnNavigate(params_A); | 815 frame()->OnNavigate(params_A); |
808 ProcessPendingMessages(); | 816 ProcessPendingMessages(); |
809 | 817 |
810 // A new navigation commits, clearing the forward history. | 818 // A new navigation commits, clearing the forward history. |
811 LoadHTML("<div>Page C</div>"); | 819 LoadHTML("<div>Page C</div>"); |
812 EXPECT_EQ(2, view()->history_list_length_); | 820 EXPECT_EQ(2, view()->history_list_length_); |
813 EXPECT_EQ(1, view()->history_list_offset_); | 821 EXPECT_EQ(1, view()->history_list_offset_); |
814 EXPECT_EQ(3, view()->history_page_ids_[1]); | 822 EXPECT_EQ(3, view()->history_page_ids_[1]); |
815 | 823 |
816 // The browser then sends a stale navigation to B, which should be ignored. | 824 // The browser then sends a stale navigation to B, which should be ignored. |
817 FrameMsg_Navigate_Params params_B; | 825 FrameMsg_Navigate_Params params_B; |
818 params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 826 params_B.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
819 params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 827 params_B.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
820 params_B.current_history_list_length = 2; | 828 params_B.current_history_list_length = 2; |
821 params_B.current_history_list_offset = 0; | 829 params_B.current_history_list_offset = 0; |
822 params_B.pending_history_list_offset = 1; | 830 params_B.pending_history_list_offset = 1; |
823 params_B.page_id = 2; | 831 params_B.page_id = 2; |
824 params_B.page_state = state_A; // Doesn't matter, just has to be present. | 832 params_B.commit_params.page_state = |
825 params_B.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 833 state_A; // Doesn't matter, just has to be present. |
| 834 params_B.commit_params.browser_navigation_start = |
| 835 base::TimeTicks::FromInternalValue(1); |
826 frame()->OnNavigate(params_B); | 836 frame()->OnNavigate(params_B); |
827 | 837 |
828 // State should be unchanged. | 838 // State should be unchanged. |
829 EXPECT_EQ(2, view()->history_list_length_); | 839 EXPECT_EQ(2, view()->history_list_length_); |
830 EXPECT_EQ(1, view()->history_list_offset_); | 840 EXPECT_EQ(1, view()->history_list_offset_); |
831 EXPECT_EQ(3, view()->history_page_ids_[1]); | 841 EXPECT_EQ(3, view()->history_page_ids_[1]); |
832 } | 842 } |
833 | 843 |
834 // Test that we do not ignore navigations after the entry limit is reached, | 844 // Test that we do not ignore navigations after the entry limit is reached, |
835 // in which case the browser starts dropping entries from the front. In this | 845 // in which case the browser starts dropping entries from the front. In this |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 ViewHostMsg_UpdateState::Read(msg_B, ¶m); | 886 ViewHostMsg_UpdateState::Read(msg_B, ¶m); |
877 int page_id_B = param.a; | 887 int page_id_B = param.a; |
878 PageState state_B = param.b; | 888 PageState state_B = param.b; |
879 EXPECT_EQ(2, page_id_B); | 889 EXPECT_EQ(2, page_id_B); |
880 render_thread_->sink().ClearMessages(); | 890 render_thread_->sink().ClearMessages(); |
881 | 891 |
882 // Suppose the browser has limited the number of NavigationEntries to 2. | 892 // Suppose the browser has limited the number of NavigationEntries to 2. |
883 // It has now dropped the first entry, but the renderer isn't notified. | 893 // It has now dropped the first entry, but the renderer isn't notified. |
884 // Ensure that going back to page B (page_id 2) at offset 0 is successful. | 894 // Ensure that going back to page B (page_id 2) at offset 0 is successful. |
885 FrameMsg_Navigate_Params params_B; | 895 FrameMsg_Navigate_Params params_B; |
886 params_B.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 896 params_B.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
887 params_B.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 897 params_B.core_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
888 params_B.current_history_list_length = 2; | 898 params_B.current_history_list_length = 2; |
889 params_B.current_history_list_offset = 1; | 899 params_B.current_history_list_offset = 1; |
890 params_B.pending_history_list_offset = 0; | 900 params_B.pending_history_list_offset = 0; |
891 params_B.page_id = 2; | 901 params_B.page_id = 2; |
892 params_B.page_state = state_B; | 902 params_B.commit_params.page_state = state_B; |
893 params_B.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 903 params_B.commit_params.browser_navigation_start = |
| 904 base::TimeTicks::FromInternalValue(1); |
894 frame()->OnNavigate(params_B); | 905 frame()->OnNavigate(params_B); |
895 ProcessPendingMessages(); | 906 ProcessPendingMessages(); |
896 | 907 |
897 EXPECT_EQ(2, view()->history_list_length_); | 908 EXPECT_EQ(2, view()->history_list_length_); |
898 EXPECT_EQ(0, view()->history_list_offset_); | 909 EXPECT_EQ(0, view()->history_list_offset_); |
899 EXPECT_EQ(2, view()->history_page_ids_[0]); | 910 EXPECT_EQ(2, view()->history_page_ids_[0]); |
900 } | 911 } |
901 | 912 |
902 // Test that our IME backend sends a notification message when the input focus | 913 // Test that our IME backend sends a notification message when the input focus |
903 // changes. | 914 // changes. |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1589 WebURLError error; | 1600 WebURLError error; |
1590 error.domain = WebString::fromUTF8(net::kErrorDomain); | 1601 error.domain = WebString::fromUTF8(net::kErrorDomain); |
1591 error.reason = net::ERR_FILE_NOT_FOUND; | 1602 error.reason = net::ERR_FILE_NOT_FOUND; |
1592 error.unreachableURL = GURL("http://foo"); | 1603 error.unreachableURL = GURL("http://foo"); |
1593 WebLocalFrame* web_frame = GetMainFrame(); | 1604 WebLocalFrame* web_frame = GetMainFrame(); |
1594 | 1605 |
1595 // Start a load that will reach provisional state synchronously, | 1606 // Start a load that will reach provisional state synchronously, |
1596 // but won't complete synchronously. | 1607 // but won't complete synchronously. |
1597 FrameMsg_Navigate_Params params; | 1608 FrameMsg_Navigate_Params params; |
1598 params.page_id = -1; | 1609 params.page_id = -1; |
1599 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1610 params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1600 params.url = GURL("data:text/html,test data"); | 1611 params.core_params.url = GURL("data:text/html,test data"); |
1601 params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 1612 params.commit_params.browser_navigation_start = |
| 1613 base::TimeTicks::FromInternalValue(1); |
1602 frame()->OnNavigate(params); | 1614 frame()->OnNavigate(params); |
1603 | 1615 |
1604 // An error occurred. | 1616 // An error occurred. |
1605 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); | 1617 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); |
1606 // Frame should exit view-source mode. | 1618 // Frame should exit view-source mode. |
1607 EXPECT_FALSE(web_frame->isViewSourceModeEnabled()); | 1619 EXPECT_FALSE(web_frame->isViewSourceModeEnabled()); |
1608 } | 1620 } |
1609 | 1621 |
1610 TEST_F(RenderViewImplTest, DidFailProvisionalLoadWithErrorForCancellation) { | 1622 TEST_F(RenderViewImplTest, DidFailProvisionalLoadWithErrorForCancellation) { |
1611 GetMainFrame()->enableViewSourceMode(true); | 1623 GetMainFrame()->enableViewSourceMode(true); |
1612 WebURLError error; | 1624 WebURLError error; |
1613 error.domain = WebString::fromUTF8(net::kErrorDomain); | 1625 error.domain = WebString::fromUTF8(net::kErrorDomain); |
1614 error.reason = net::ERR_ABORTED; | 1626 error.reason = net::ERR_ABORTED; |
1615 error.unreachableURL = GURL("http://foo"); | 1627 error.unreachableURL = GURL("http://foo"); |
1616 WebLocalFrame* web_frame = GetMainFrame(); | 1628 WebLocalFrame* web_frame = GetMainFrame(); |
1617 | 1629 |
1618 // Start a load that will reach provisional state synchronously, | 1630 // Start a load that will reach provisional state synchronously, |
1619 // but won't complete synchronously. | 1631 // but won't complete synchronously. |
1620 FrameMsg_Navigate_Params params; | 1632 FrameMsg_Navigate_Params params; |
1621 params.page_id = -1; | 1633 params.page_id = -1; |
1622 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 1634 params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
1623 params.url = GURL("data:text/html,test data"); | 1635 params.core_params.url = GURL("data:text/html,test data"); |
1624 params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 1636 params.commit_params.browser_navigation_start = |
| 1637 base::TimeTicks::FromInternalValue(1); |
1625 frame()->OnNavigate(params); | 1638 frame()->OnNavigate(params); |
1626 | 1639 |
1627 // A cancellation occurred. | 1640 // A cancellation occurred. |
1628 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); | 1641 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); |
1629 // Frame should stay in view-source mode. | 1642 // Frame should stay in view-source mode. |
1630 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); | 1643 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); |
1631 } | 1644 } |
1632 | 1645 |
1633 // Regression test for http://crbug.com/41562 | 1646 // Regression test for http://crbug.com/41562 |
1634 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { | 1647 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 empty_string, gfx::Range::InvalidRange(), false); | 2007 empty_string, gfx::Range::InvalidRange(), false); |
1995 } | 2008 } |
1996 #endif | 2009 #endif |
1997 | 2010 |
1998 TEST_F(RenderViewImplTest, ZoomLimit) { | 2011 TEST_F(RenderViewImplTest, ZoomLimit) { |
1999 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); | 2012 const double kMinZoomLevel = ZoomFactorToZoomLevel(kMinimumZoomFactor); |
2000 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); | 2013 const double kMaxZoomLevel = ZoomFactorToZoomLevel(kMaximumZoomFactor); |
2001 | 2014 |
2002 FrameMsg_Navigate_Params params; | 2015 FrameMsg_Navigate_Params params; |
2003 params.page_id = -1; | 2016 params.page_id = -1; |
2004 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2017 params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
2005 params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 2018 params.commit_params.browser_navigation_start = |
| 2019 base::TimeTicks::FromInternalValue(1); |
2006 | 2020 |
2007 // Verifies navigation to a URL with preset zoom level indeed sets the level. | 2021 // Verifies navigation to a URL with preset zoom level indeed sets the level. |
2008 // Regression test for http://crbug.com/139559, where the level was not | 2022 // Regression test for http://crbug.com/139559, where the level was not |
2009 // properly set when it is out of the default zoom limits of WebView. | 2023 // properly set when it is out of the default zoom limits of WebView. |
2010 params.url = GURL("data:text/html,min_zoomlimit_test"); | 2024 params.core_params.url = GURL("data:text/html,min_zoomlimit_test"); |
2011 view()->OnSetZoomLevelForLoadingURL(params.url, kMinZoomLevel); | 2025 view()->OnSetZoomLevelForLoadingURL(params.core_params.url, kMinZoomLevel); |
2012 frame()->OnNavigate(params); | 2026 frame()->OnNavigate(params); |
2013 ProcessPendingMessages(); | 2027 ProcessPendingMessages(); |
2014 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); | 2028 EXPECT_DOUBLE_EQ(kMinZoomLevel, view()->GetWebView()->zoomLevel()); |
2015 | 2029 |
2016 // It should work even when the zoom limit is temporarily changed in the page. | 2030 // It should work even when the zoom limit is temporarily changed in the page. |
2017 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), | 2031 view()->GetWebView()->zoomLimitsChanged(ZoomFactorToZoomLevel(1.0), |
2018 ZoomFactorToZoomLevel(1.0)); | 2032 ZoomFactorToZoomLevel(1.0)); |
2019 params.url = GURL("data:text/html,max_zoomlimit_test"); | 2033 params.core_params.url = GURL("data:text/html,max_zoomlimit_test"); |
2020 view()->OnSetZoomLevelForLoadingURL(params.url, kMaxZoomLevel); | 2034 view()->OnSetZoomLevelForLoadingURL(params.core_params.url, kMaxZoomLevel); |
2021 frame()->OnNavigate(params); | 2035 frame()->OnNavigate(params); |
2022 ProcessPendingMessages(); | 2036 ProcessPendingMessages(); |
2023 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); | 2037 EXPECT_DOUBLE_EQ(kMaxZoomLevel, view()->GetWebView()->zoomLevel()); |
2024 } | 2038 } |
2025 | 2039 |
2026 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { | 2040 TEST_F(RenderViewImplTest, SetEditableSelectionAndComposition) { |
2027 // Load an HTML page consisting of an input field. | 2041 // Load an HTML page consisting of an input field. |
2028 LoadHTML("<html>" | 2042 LoadHTML("<html>" |
2029 "<head>" | 2043 "<head>" |
2030 "</head>" | 2044 "</head>" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 EXPECT_EQ(2, info.selectionEnd); | 2086 EXPECT_EQ(2, info.selectionEnd); |
2073 } | 2087 } |
2074 | 2088 |
2075 // Test that the navigating specific frames works correctly. | 2089 // Test that the navigating specific frames works correctly. |
2076 TEST_F(RenderViewImplTest, NavigateFrame) { | 2090 TEST_F(RenderViewImplTest, NavigateFrame) { |
2077 // Load page A. | 2091 // Load page A. |
2078 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); | 2092 LoadHTML("hello <iframe srcdoc='fail' name='frame'></iframe>"); |
2079 | 2093 |
2080 // Navigate the frame only. | 2094 // Navigate the frame only. |
2081 FrameMsg_Navigate_Params nav_params; | 2095 FrameMsg_Navigate_Params nav_params; |
2082 nav_params.url = GURL("data:text/html,world"); | 2096 nav_params.core_params.url = GURL("data:text/html,world"); |
2083 nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2097 nav_params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
2084 nav_params.transition = ui::PAGE_TRANSITION_TYPED; | 2098 nav_params.core_params.transition = ui::PAGE_TRANSITION_TYPED; |
2085 nav_params.current_history_list_length = 1; | 2099 nav_params.current_history_list_length = 1; |
2086 nav_params.current_history_list_offset = 0; | 2100 nav_params.current_history_list_offset = 0; |
2087 nav_params.pending_history_list_offset = 1; | 2101 nav_params.pending_history_list_offset = 1; |
2088 nav_params.page_id = -1; | 2102 nav_params.page_id = -1; |
2089 nav_params.frame_to_navigate = "frame"; | 2103 nav_params.frame_to_navigate = "frame"; |
2090 nav_params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 2104 nav_params.commit_params.browser_navigation_start = |
| 2105 base::TimeTicks::FromInternalValue(1); |
2091 frame()->OnNavigate(nav_params); | 2106 frame()->OnNavigate(nav_params); |
2092 FrameLoadWaiter( | 2107 FrameLoadWaiter( |
2093 RenderFrame::FromWebFrame(frame()->GetWebFrame()->firstChild())).Wait(); | 2108 RenderFrame::FromWebFrame(frame()->GetWebFrame()->firstChild())).Wait(); |
2094 | 2109 |
2095 // Copy the document content to std::wstring and compare with the | 2110 // Copy the document content to std::wstring and compare with the |
2096 // expected result. | 2111 // expected result. |
2097 const int kMaxOutputCharacters = 256; | 2112 const int kMaxOutputCharacters = 256; |
2098 std::string output = base::UTF16ToUTF8( | 2113 std::string output = base::UTF16ToUTF8( |
2099 GetMainFrame()->contentAsText(kMaxOutputCharacters)); | 2114 GetMainFrame()->contentAsText(kMaxOutputCharacters)); |
2100 EXPECT_EQ(output, "hello \n\nworld"); | 2115 EXPECT_EQ(output, "hello \n\nworld"); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2198 WebURLError error; | 2213 WebURLError error; |
2199 error.domain = WebString::fromUTF8(net::kErrorDomain); | 2214 error.domain = WebString::fromUTF8(net::kErrorDomain); |
2200 error.reason = net::ERR_FILE_NOT_FOUND; | 2215 error.reason = net::ERR_FILE_NOT_FOUND; |
2201 error.unreachableURL = GURL("http://example.com/suppress"); | 2216 error.unreachableURL = GURL("http://example.com/suppress"); |
2202 WebLocalFrame* web_frame = GetMainFrame(); | 2217 WebLocalFrame* web_frame = GetMainFrame(); |
2203 | 2218 |
2204 // Start a load that will reach provisional state synchronously, | 2219 // Start a load that will reach provisional state synchronously, |
2205 // but won't complete synchronously. | 2220 // but won't complete synchronously. |
2206 FrameMsg_Navigate_Params params; | 2221 FrameMsg_Navigate_Params params; |
2207 params.page_id = -1; | 2222 params.page_id = -1; |
2208 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2223 params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
2209 params.url = GURL("data:text/html,test data"); | 2224 params.core_params.url = GURL("data:text/html,test data"); |
2210 params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 2225 params.commit_params.browser_navigation_start = |
| 2226 base::TimeTicks::FromInternalValue(1); |
2211 frame()->OnNavigate(params); | 2227 frame()->OnNavigate(params); |
2212 | 2228 |
2213 // An error occurred. | 2229 // An error occurred. |
2214 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); | 2230 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); |
2215 const int kMaxOutputCharacters = 22; | 2231 const int kMaxOutputCharacters = 22; |
2216 EXPECT_EQ("", | 2232 EXPECT_EQ("", |
2217 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2233 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
2218 } | 2234 } |
2219 | 2235 |
2220 #if defined(OS_ANDROID) | 2236 #if defined(OS_ANDROID) |
2221 // Crashing on Android: http://crbug.com/311341 | 2237 // Crashing on Android: http://crbug.com/311341 |
2222 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress | 2238 #define MAYBE_DoesNotSuppress DISABLED_DoesNotSuppress |
2223 #else | 2239 #else |
2224 #define MAYBE_DoesNotSuppress DoesNotSuppress | 2240 #define MAYBE_DoesNotSuppress DoesNotSuppress |
2225 #endif | 2241 #endif |
2226 | 2242 |
2227 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { | 2243 TEST_F(SuppressErrorPageTest, MAYBE_DoesNotSuppress) { |
2228 WebURLError error; | 2244 WebURLError error; |
2229 error.domain = WebString::fromUTF8(net::kErrorDomain); | 2245 error.domain = WebString::fromUTF8(net::kErrorDomain); |
2230 error.reason = net::ERR_FILE_NOT_FOUND; | 2246 error.reason = net::ERR_FILE_NOT_FOUND; |
2231 error.unreachableURL = GURL("http://example.com/dont-suppress"); | 2247 error.unreachableURL = GURL("http://example.com/dont-suppress"); |
2232 WebLocalFrame* web_frame = GetMainFrame(); | 2248 WebLocalFrame* web_frame = GetMainFrame(); |
2233 | 2249 |
2234 // Start a load that will reach provisional state synchronously, | 2250 // Start a load that will reach provisional state synchronously, |
2235 // but won't complete synchronously. | 2251 // but won't complete synchronously. |
2236 FrameMsg_Navigate_Params params; | 2252 FrameMsg_Navigate_Params params; |
2237 params.page_id = -1; | 2253 params.page_id = -1; |
2238 params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2254 params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
2239 params.url = GURL("data:text/html,test data"); | 2255 params.core_params.url = GURL("data:text/html,test data"); |
2240 params.browser_navigation_start = base::TimeTicks::FromInternalValue(1); | 2256 params.commit_params.browser_navigation_start = |
| 2257 base::TimeTicks::FromInternalValue(1); |
2241 frame()->OnNavigate(params); | 2258 frame()->OnNavigate(params); |
2242 | 2259 |
2243 // An error occurred. | 2260 // An error occurred. |
2244 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); | 2261 view()->GetMainRenderFrame()->didFailProvisionalLoad(web_frame, error); |
2245 // The error page itself is loaded asynchronously. | 2262 // The error page itself is loaded asynchronously. |
2246 FrameLoadWaiter(frame()).Wait(); | 2263 FrameLoadWaiter(frame()).Wait(); |
2247 const int kMaxOutputCharacters = 22; | 2264 const int kMaxOutputCharacters = 22; |
2248 EXPECT_EQ("A suffusion of yellow.", | 2265 EXPECT_EQ("A suffusion of yellow.", |
2249 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); | 2266 base::UTF16ToASCII(web_frame->contentAsText(kMaxOutputCharacters))); |
2250 } | 2267 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 | 2458 |
2442 // Sanity checks for the Navigation Timing API |navigationStart| override. We | 2459 // Sanity checks for the Navigation Timing API |navigationStart| override. We |
2443 // are asserting only most basic constraints, as TimeTicks (passed as the | 2460 // are asserting only most basic constraints, as TimeTicks (passed as the |
2444 // override) are not comparable with the wall time (returned by the Blink API). | 2461 // override) are not comparable with the wall time (returned by the Blink API). |
2445 TEST_F(RenderViewImplTest, NavigationStartOverride) { | 2462 TEST_F(RenderViewImplTest, NavigationStartOverride) { |
2446 // Verify that a navigation that claims to have started at the earliest | 2463 // Verify that a navigation that claims to have started at the earliest |
2447 // possible TimeTicks is indeed reported as one that started before | 2464 // possible TimeTicks is indeed reported as one that started before |
2448 // OnNavigate() is called. | 2465 // OnNavigate() is called. |
2449 base::Time before_navigation = base::Time::Now(); | 2466 base::Time before_navigation = base::Time::Now(); |
2450 FrameMsg_Navigate_Params early_nav_params; | 2467 FrameMsg_Navigate_Params early_nav_params; |
2451 early_nav_params.url = GURL("data:text/html,<div>Page</div>"); | 2468 early_nav_params.core_params.url = GURL("data:text/html,<div>Page</div>"); |
2452 early_nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2469 early_nav_params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
2453 early_nav_params.transition = ui::PAGE_TRANSITION_TYPED; | 2470 early_nav_params.core_params.transition = ui::PAGE_TRANSITION_TYPED; |
2454 early_nav_params.page_id = -1; | 2471 early_nav_params.page_id = -1; |
2455 early_nav_params.is_post = true; | 2472 early_nav_params.request_params.is_post = true; |
2456 early_nav_params.browser_navigation_start = | 2473 early_nav_params.commit_params.browser_navigation_start = |
2457 base::TimeTicks::FromInternalValue(1); | 2474 base::TimeTicks::FromInternalValue(1); |
2458 | 2475 |
2459 frame()->OnNavigate(early_nav_params); | 2476 frame()->OnNavigate(early_nav_params); |
2460 ProcessPendingMessages(); | 2477 ProcessPendingMessages(); |
2461 | 2478 |
2462 base::Time early_nav_reported_start = | 2479 base::Time early_nav_reported_start = |
2463 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2480 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
2464 EXPECT_LT(early_nav_reported_start, before_navigation); | 2481 EXPECT_LT(early_nav_reported_start, before_navigation); |
2465 | 2482 |
2466 // Verify that a navigation that claims to have started in the future - 42 | 2483 // Verify that a navigation that claims to have started in the future - 42 |
2467 // days from now is *not* reported as one that starts in the future; as we | 2484 // days from now is *not* reported as one that starts in the future; as we |
2468 // sanitize the override allowing a maximum of ::Now(). | 2485 // sanitize the override allowing a maximum of ::Now(). |
2469 FrameMsg_Navigate_Params late_nav_params; | 2486 FrameMsg_Navigate_Params late_nav_params; |
2470 late_nav_params.url = GURL("data:text/html,<div>Another page</div>"); | 2487 late_nav_params.core_params.url = |
2471 late_nav_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 2488 GURL("data:text/html,<div>Another page</div>"); |
2472 late_nav_params.transition = ui::PAGE_TRANSITION_TYPED; | 2489 late_nav_params.core_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| 2490 late_nav_params.core_params.transition = ui::PAGE_TRANSITION_TYPED; |
2473 late_nav_params.page_id = -1; | 2491 late_nav_params.page_id = -1; |
2474 late_nav_params.is_post = true; | 2492 late_nav_params.request_params.is_post = true; |
2475 late_nav_params.browser_navigation_start = | 2493 late_nav_params.commit_params.browser_navigation_start = |
2476 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); | 2494 base::TimeTicks::Now() + base::TimeDelta::FromDays(42); |
2477 | 2495 |
2478 frame()->OnNavigate(late_nav_params); | 2496 frame()->OnNavigate(late_nav_params); |
2479 ProcessPendingMessages(); | 2497 ProcessPendingMessages(); |
2480 base::Time after_navigation = | 2498 base::Time after_navigation = |
2481 base::Time::Now() + base::TimeDelta::FromDays(1); | 2499 base::Time::Now() + base::TimeDelta::FromDays(1); |
2482 | 2500 |
2483 base::Time late_nav_reported_start = | 2501 base::Time late_nav_reported_start = |
2484 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); | 2502 base::Time::FromDoubleT(GetMainFrame()->performance().navigationStart()); |
2485 EXPECT_LE(late_nav_reported_start, after_navigation); | 2503 EXPECT_LE(late_nav_reported_start, after_navigation); |
2486 } | 2504 } |
2487 | 2505 |
2488 } // namespace content | 2506 } // namespace content |
OLD | NEW |