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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
749 ASSERT_TRUE(msg); | 749 ASSERT_TRUE(msg); |
750 ViewHostMsg_UpdateState::Read(msg, ¶m); | 750 ViewHostMsg_UpdateState::Read(msg, ¶m); |
751 int page_id = param.a; | 751 int page_id = param.a; |
752 PageState state = param.b; | 752 PageState state = param.b; |
753 EXPECT_EQ(page_id_C, page_id); | 753 EXPECT_EQ(page_id_C, page_id); |
754 EXPECT_NE(state_A, state); | 754 EXPECT_NE(state_A, state); |
755 EXPECT_NE(state_B, state); | 755 EXPECT_NE(state_B, state); |
756 EXPECT_EQ(state_C, state); | 756 EXPECT_EQ(state_C, state); |
757 } | 757 } |
758 | 758 |
759 // Test that the history_page_ids_ list can reveal when a stale back/forward | 759 // Test that stale back/forward navigations arriving from the browser are |
760 // navigation arrives from the browser and can be ignored. See | 760 // ignored. See http://crbug.com/86758. |
761 // http://crbug.com/86758. | |
762 TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { | 761 TEST_F(RenderViewImplTest, StaleNavigationsIgnored) { |
Charlie Reis
2014/12/03 23:48:07
Did you end up getting these tests to fail when yo
Avi (use Gerrit)
2014/12/04 21:15:16
Yes, this test fails in the same way as it did wit
| |
763 // Load page A. | 762 // Load page A. |
764 LoadHTML("<div>Page A</div>"); | 763 LoadHTML("<div>Page A</div>"); |
765 EXPECT_EQ(1, view()->history_list_length_); | 764 EXPECT_EQ(1, view()->history_list_length_); |
766 EXPECT_EQ(0, view()->history_list_offset_); | 765 EXPECT_EQ(0, view()->history_list_offset_); |
767 EXPECT_EQ(1, view()->history_page_ids_[0]); | |
768 | 766 |
769 // Load page B, which will trigger an UpdateState message for page A. | 767 // Load page B, which will trigger an UpdateState message for page A. |
770 LoadHTML("<div>Page B</div>"); | 768 LoadHTML("<div>Page B</div>"); |
771 EXPECT_EQ(2, view()->history_list_length_); | 769 EXPECT_EQ(2, view()->history_list_length_); |
772 EXPECT_EQ(1, view()->history_list_offset_); | 770 EXPECT_EQ(1, view()->history_list_offset_); |
773 EXPECT_EQ(2, view()->history_page_ids_[1]); | |
774 | 771 |
775 // Check for a valid UpdateState message for page A. | 772 // Check for a valid UpdateState message for page A. |
776 ProcessPendingMessages(); | 773 ProcessPendingMessages(); |
777 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching( | 774 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching( |
778 ViewHostMsg_UpdateState::ID); | 775 ViewHostMsg_UpdateState::ID); |
779 ASSERT_TRUE(msg_A); | 776 ASSERT_TRUE(msg_A); |
780 ViewHostMsg_UpdateState::Param param; | 777 ViewHostMsg_UpdateState::Param param; |
781 ViewHostMsg_UpdateState::Read(msg_A, ¶m); | 778 ViewHostMsg_UpdateState::Read(msg_A, ¶m); |
782 int page_id_A = param.a; | 779 int page_id_A = param.a; |
783 PageState state_A = param.b; | 780 PageState state_A = param.b; |
(...skipping 11 matching lines...) Expand all Loading... | |
795 params_A.commit_params.page_state = state_A; | 792 params_A.commit_params.page_state = state_A; |
796 params_A.commit_params.browser_navigation_start = | 793 params_A.commit_params.browser_navigation_start = |
797 base::TimeTicks::FromInternalValue(1); | 794 base::TimeTicks::FromInternalValue(1); |
798 frame()->OnNavigate(params_A); | 795 frame()->OnNavigate(params_A); |
799 ProcessPendingMessages(); | 796 ProcessPendingMessages(); |
800 | 797 |
801 // A new navigation commits, clearing the forward history. | 798 // A new navigation commits, clearing the forward history. |
802 LoadHTML("<div>Page C</div>"); | 799 LoadHTML("<div>Page C</div>"); |
803 EXPECT_EQ(2, view()->history_list_length_); | 800 EXPECT_EQ(2, view()->history_list_length_); |
804 EXPECT_EQ(1, view()->history_list_offset_); | 801 EXPECT_EQ(1, view()->history_list_offset_); |
805 EXPECT_EQ(3, view()->history_page_ids_[1]); | 802 EXPECT_EQ(3, view()->page_id_); // page C is now page id 3 |
806 | 803 |
807 // The browser then sends a stale navigation to B, which should be ignored. | 804 // The browser then sends a stale navigation to B, which should be ignored. |
808 FrameMsg_Navigate_Params params_B; | 805 FrameMsg_Navigate_Params params_B; |
809 params_B.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 806 params_B.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
810 params_B.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 807 params_B.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
811 params_B.current_history_list_length = 2; | 808 params_B.current_history_list_length = 2; |
812 params_B.current_history_list_offset = 0; | 809 params_B.current_history_list_offset = 0; |
813 params_B.pending_history_list_offset = 1; | 810 params_B.pending_history_list_offset = 1; |
814 params_B.page_id = 2; | 811 params_B.page_id = 2; |
815 params_B.commit_params.page_state = | 812 params_B.commit_params.page_state = |
816 state_A; // Doesn't matter, just has to be present. | 813 state_A; // Doesn't matter, just has to be present. |
817 params_B.commit_params.browser_navigation_start = | 814 params_B.commit_params.browser_navigation_start = |
818 base::TimeTicks::FromInternalValue(1); | 815 base::TimeTicks::FromInternalValue(1); |
819 frame()->OnNavigate(params_B); | 816 frame()->OnNavigate(params_B); |
820 | 817 |
821 // State should be unchanged. | 818 // State should be unchanged. |
822 EXPECT_EQ(2, view()->history_list_length_); | 819 EXPECT_EQ(2, view()->history_list_length_); |
823 EXPECT_EQ(1, view()->history_list_offset_); | 820 EXPECT_EQ(1, view()->history_list_offset_); |
824 EXPECT_EQ(3, view()->history_page_ids_[1]); | 821 EXPECT_EQ(3, view()->page_id_); // page C, not page B |
825 } | |
826 | |
827 // Test that we do not ignore navigations after the entry limit is reached, | |
828 // in which case the browser starts dropping entries from the front. In this | |
829 // case, we'll see a page_id mismatch but the RenderView's id will be older, | |
830 // not newer, than params.page_id. Use this as a cue that we should update the | |
831 // state and not treat it like a navigation to a cropped forward history item. | |
832 // See http://crbug.com/89798. | |
833 TEST_F(RenderViewImplTest, DontIgnoreBackAfterNavEntryLimit) { | |
Charlie Reis
2014/12/03 23:48:07
Yeah, this is the similar to the test we would nee
Avi (use Gerrit)
2014/12/04 21:15:16
This is one of those tests where it's testing beha
Charlie Reis
2014/12/04 23:13:58
Acknowledged.
| |
834 // Load page A. | |
835 LoadHTML("<div>Page A</div>"); | |
836 EXPECT_EQ(1, view()->history_list_length_); | |
837 EXPECT_EQ(0, view()->history_list_offset_); | |
838 EXPECT_EQ(1, view()->history_page_ids_[0]); | |
839 | |
840 // Load page B, which will trigger an UpdateState message for page A. | |
841 LoadHTML("<div>Page B</div>"); | |
842 EXPECT_EQ(2, view()->history_list_length_); | |
843 EXPECT_EQ(1, view()->history_list_offset_); | |
844 EXPECT_EQ(2, view()->history_page_ids_[1]); | |
845 | |
846 // Check for a valid UpdateState message for page A. | |
847 ProcessPendingMessages(); | |
848 const IPC::Message* msg_A = render_thread_->sink().GetUniqueMessageMatching( | |
849 ViewHostMsg_UpdateState::ID); | |
850 ASSERT_TRUE(msg_A); | |
851 ViewHostMsg_UpdateState::Param param; | |
852 ViewHostMsg_UpdateState::Read(msg_A, ¶m); | |
853 int page_id_A = param.a; | |
854 PageState state_A = param.b; | |
855 EXPECT_EQ(1, page_id_A); | |
856 render_thread_->sink().ClearMessages(); | |
857 | |
858 // Load page C, which will trigger an UpdateState message for page B. | |
859 LoadHTML("<div>Page C</div>"); | |
860 EXPECT_EQ(3, view()->history_list_length_); | |
861 EXPECT_EQ(2, view()->history_list_offset_); | |
862 EXPECT_EQ(3, view()->history_page_ids_[2]); | |
863 | |
864 // Check for a valid UpdateState message for page B. | |
865 ProcessPendingMessages(); | |
866 const IPC::Message* msg_B = render_thread_->sink().GetUniqueMessageMatching( | |
867 ViewHostMsg_UpdateState::ID); | |
868 ASSERT_TRUE(msg_B); | |
869 ViewHostMsg_UpdateState::Read(msg_B, ¶m); | |
870 int page_id_B = param.a; | |
871 PageState state_B = param.b; | |
872 EXPECT_EQ(2, page_id_B); | |
873 render_thread_->sink().ClearMessages(); | |
874 | |
875 // Suppose the browser has limited the number of NavigationEntries to 2. | |
876 // It has now dropped the first entry, but the renderer isn't notified. | |
Charlie Reis
2014/12/03 23:48:07
Oh, fun... The renderer isn't even notified when w
Avi (use Gerrit)
2014/12/04 21:15:16
That actually caused a bug, if you remember; both
| |
877 // Ensure that going back to page B (page_id 2) at offset 0 is successful. | |
878 FrameMsg_Navigate_Params params_B; | |
879 params_B.common_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | |
880 params_B.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | |
881 params_B.current_history_list_length = 2; | |
882 params_B.current_history_list_offset = 1; | |
883 params_B.pending_history_list_offset = 0; | |
884 params_B.page_id = 2; | |
885 params_B.commit_params.page_state = state_B; | |
886 params_B.commit_params.browser_navigation_start = | |
887 base::TimeTicks::FromInternalValue(1); | |
888 frame()->OnNavigate(params_B); | |
889 ProcessPendingMessages(); | |
890 | |
891 EXPECT_EQ(2, view()->history_list_length_); | |
892 EXPECT_EQ(0, view()->history_list_offset_); | |
893 EXPECT_EQ(2, view()->history_page_ids_[0]); | |
894 } | 822 } |
895 | 823 |
896 // Test that our IME backend sends a notification message when the input focus | 824 // Test that our IME backend sends a notification message when the input focus |
897 // changes. | 825 // changes. |
898 TEST_F(RenderViewImplTest, OnImeTypeChanged) { | 826 TEST_F(RenderViewImplTest, OnImeTypeChanged) { |
899 // Enable our IME backend code. | 827 // Enable our IME backend code. |
900 view()->OnSetInputMethodActive(true); | 828 view()->OnSetInputMethodActive(true); |
901 | 829 |
902 // Load an HTML page consisting of two input fields. | 830 // Load an HTML page consisting of two input fields. |
903 view()->set_send_content_state_immediately(true); | 831 view()->set_send_content_state_immediately(true); |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1628 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); | 1556 EXPECT_TRUE(web_frame->isViewSourceModeEnabled()); |
1629 } | 1557 } |
1630 | 1558 |
1631 // Regression test for http://crbug.com/41562 | 1559 // Regression test for http://crbug.com/41562 |
1632 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { | 1560 TEST_F(RenderViewImplTest, UpdateTargetURLWithInvalidURL) { |
1633 const GURL invalid_gurl("http://"); | 1561 const GURL invalid_gurl("http://"); |
1634 view()->setMouseOverURL(blink::WebURL(invalid_gurl)); | 1562 view()->setMouseOverURL(blink::WebURL(invalid_gurl)); |
1635 EXPECT_EQ(invalid_gurl, view()->target_url_); | 1563 EXPECT_EQ(invalid_gurl, view()->target_url_); |
1636 } | 1564 } |
1637 | 1565 |
1638 TEST_F(RenderViewImplTest, SetHistoryLengthAndPrune) { | 1566 TEST_F(RenderViewImplTest, SetHistoryLengthAndOffset) { |
1639 int expected_page_id = -1; | 1567 // No history to merge; one committed page. |
1568 view()->OnSetHistoryOffsetAndLength(0, 1); | |
1569 EXPECT_EQ(1, view()->history_list_length_); | |
1570 EXPECT_EQ(0, view()->history_list_offset_); | |
1640 | 1571 |
1641 // No history to merge and no committed pages. | 1572 // History of length 1 to merge; one committed page. |
1642 view()->OnSetHistoryLengthAndPrune(0, -1); | 1573 view()->OnSetHistoryOffsetAndLength(1, 2); |
1643 EXPECT_EQ(0, view()->history_list_length_); | |
1644 EXPECT_EQ(-1, view()->history_list_offset_); | |
1645 | |
1646 // History to merge and no committed pages. | |
1647 view()->OnSetHistoryLengthAndPrune(2, -1); | |
1648 EXPECT_EQ(2, view()->history_list_length_); | 1574 EXPECT_EQ(2, view()->history_list_length_); |
1649 EXPECT_EQ(1, view()->history_list_offset_); | 1575 EXPECT_EQ(1, view()->history_list_offset_); |
1650 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1651 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1652 ClearHistory(); | |
1653 | |
1654 blink::WebHistoryItem item; | |
1655 item.initialize(); | |
1656 | |
1657 // No history to merge and a committed page to be kept. | |
1658 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1659 item, | |
1660 blink::WebStandardCommit); | |
1661 expected_page_id = view()->page_id_; | |
1662 view()->OnSetHistoryLengthAndPrune(0, expected_page_id); | |
1663 EXPECT_EQ(1, view()->history_list_length_); | |
1664 EXPECT_EQ(0, view()->history_list_offset_); | |
1665 EXPECT_EQ(expected_page_id, view()->history_page_ids_[0]); | |
1666 ClearHistory(); | |
1667 | |
1668 // No history to merge and a committed page to be pruned. | |
1669 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1670 item, | |
1671 blink::WebStandardCommit); | |
1672 expected_page_id = view()->page_id_; | |
1673 view()->OnSetHistoryLengthAndPrune(0, expected_page_id + 1); | |
1674 EXPECT_EQ(0, view()->history_list_length_); | |
1675 EXPECT_EQ(-1, view()->history_list_offset_); | |
1676 ClearHistory(); | |
1677 | |
1678 // No history to merge and a committed page that the browser was unaware of. | |
1679 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1680 item, | |
1681 blink::WebStandardCommit); | |
1682 expected_page_id = view()->page_id_; | |
1683 view()->OnSetHistoryLengthAndPrune(0, -1); | |
1684 EXPECT_EQ(1, view()->history_list_length_); | |
1685 EXPECT_EQ(0, view()->history_list_offset_); | |
1686 EXPECT_EQ(expected_page_id, view()->history_page_ids_[0]); | |
1687 ClearHistory(); | |
1688 | |
1689 // History to merge and a committed page to be kept. | |
1690 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1691 item, | |
1692 blink::WebStandardCommit); | |
1693 expected_page_id = view()->page_id_; | |
1694 view()->OnSetHistoryLengthAndPrune(2, expected_page_id); | |
1695 EXPECT_EQ(3, view()->history_list_length_); | |
1696 EXPECT_EQ(2, view()->history_list_offset_); | |
1697 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1698 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1699 EXPECT_EQ(expected_page_id, view()->history_page_ids_[2]); | |
1700 ClearHistory(); | |
1701 | |
1702 // History to merge and a committed page to be pruned. | |
1703 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1704 item, | |
1705 blink::WebStandardCommit); | |
1706 expected_page_id = view()->page_id_; | |
1707 view()->OnSetHistoryLengthAndPrune(2, expected_page_id + 1); | |
1708 EXPECT_EQ(2, view()->history_list_length_); | |
1709 EXPECT_EQ(1, view()->history_list_offset_); | |
1710 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1711 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1712 ClearHistory(); | |
1713 | |
1714 // History to merge and a committed page that the browser was unaware of. | |
1715 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1716 item, | |
1717 blink::WebStandardCommit); | |
1718 expected_page_id = view()->page_id_; | |
1719 view()->OnSetHistoryLengthAndPrune(2, -1); | |
1720 EXPECT_EQ(3, view()->history_list_length_); | |
1721 EXPECT_EQ(2, view()->history_list_offset_); | |
1722 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1723 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1724 EXPECT_EQ(expected_page_id, view()->history_page_ids_[2]); | |
1725 ClearHistory(); | |
1726 | |
1727 int expected_page_id_2 = -1; | |
1728 | |
1729 // No history to merge and two committed pages, both to be kept. | |
1730 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1731 item, | |
1732 blink::WebStandardCommit); | |
1733 expected_page_id = view()->page_id_; | |
1734 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1735 item, | |
1736 blink::WebStandardCommit); | |
1737 expected_page_id_2 = view()->page_id_; | |
1738 EXPECT_GT(expected_page_id_2, expected_page_id); | |
1739 view()->OnSetHistoryLengthAndPrune(0, expected_page_id); | |
1740 EXPECT_EQ(2, view()->history_list_length_); | |
1741 EXPECT_EQ(1, view()->history_list_offset_); | |
1742 EXPECT_EQ(expected_page_id, view()->history_page_ids_[0]); | |
1743 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[1]); | |
1744 ClearHistory(); | |
1745 | |
1746 // No history to merge and two committed pages, and only the second is kept. | |
1747 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1748 item, | |
1749 blink::WebStandardCommit); | |
1750 expected_page_id = view()->page_id_; | |
1751 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1752 item, | |
1753 blink::WebStandardCommit); | |
1754 expected_page_id_2 = view()->page_id_; | |
1755 EXPECT_GT(expected_page_id_2, expected_page_id); | |
1756 view()->OnSetHistoryLengthAndPrune(0, expected_page_id_2); | |
1757 EXPECT_EQ(1, view()->history_list_length_); | |
1758 EXPECT_EQ(0, view()->history_list_offset_); | |
1759 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[0]); | |
1760 ClearHistory(); | |
1761 | |
1762 // No history to merge and two committed pages, both of which the browser was | |
1763 // unaware of. | |
1764 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1765 item, | |
1766 blink::WebStandardCommit); | |
1767 expected_page_id = view()->page_id_; | |
1768 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1769 item, | |
1770 blink::WebStandardCommit); | |
1771 expected_page_id_2 = view()->page_id_; | |
1772 EXPECT_GT(expected_page_id_2, expected_page_id); | |
1773 view()->OnSetHistoryLengthAndPrune(0, -1); | |
1774 EXPECT_EQ(2, view()->history_list_length_); | |
1775 EXPECT_EQ(1, view()->history_list_offset_); | |
1776 EXPECT_EQ(expected_page_id, view()->history_page_ids_[0]); | |
1777 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[1]); | |
1778 ClearHistory(); | |
1779 | |
1780 // History to merge and two committed pages, both to be kept. | |
1781 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1782 item, | |
1783 blink::WebStandardCommit); | |
1784 expected_page_id = view()->page_id_; | |
1785 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1786 item, | |
1787 blink::WebStandardCommit); | |
1788 expected_page_id_2 = view()->page_id_; | |
1789 EXPECT_GT(expected_page_id_2, expected_page_id); | |
1790 view()->OnSetHistoryLengthAndPrune(2, expected_page_id); | |
1791 EXPECT_EQ(4, view()->history_list_length_); | |
1792 EXPECT_EQ(3, view()->history_list_offset_); | |
1793 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1794 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1795 EXPECT_EQ(expected_page_id, view()->history_page_ids_[2]); | |
1796 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[3]); | |
1797 ClearHistory(); | |
1798 | |
1799 // History to merge and two committed pages, and only the second is kept. | |
1800 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1801 item, | |
1802 blink::WebStandardCommit); | |
1803 expected_page_id = view()->page_id_; | |
1804 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1805 item, | |
1806 blink::WebStandardCommit); | |
1807 expected_page_id_2 = view()->page_id_; | |
1808 EXPECT_GT(expected_page_id_2, expected_page_id); | |
1809 view()->OnSetHistoryLengthAndPrune(2, expected_page_id_2); | |
1810 EXPECT_EQ(3, view()->history_list_length_); | |
1811 EXPECT_EQ(2, view()->history_list_offset_); | |
1812 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1813 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1814 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[2]); | |
1815 ClearHistory(); | |
1816 | |
1817 // History to merge and two committed pages, both of which the browser was | |
1818 // unaware of. | |
1819 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1820 item, | |
1821 blink::WebStandardCommit); | |
1822 expected_page_id = view()->page_id_; | |
1823 frame()->didCommitProvisionalLoad(GetMainFrame(), | |
1824 item, | |
1825 blink::WebStandardCommit); | |
1826 expected_page_id_2 = view()->page_id_; | |
1827 EXPECT_GT(expected_page_id_2, expected_page_id); | |
1828 view()->OnSetHistoryLengthAndPrune(2, -1); | |
1829 EXPECT_EQ(4, view()->history_list_length_); | |
1830 EXPECT_EQ(3, view()->history_list_offset_); | |
1831 EXPECT_EQ(-1, view()->history_page_ids_[0]); | |
1832 EXPECT_EQ(-1, view()->history_page_ids_[1]); | |
1833 EXPECT_EQ(expected_page_id, view()->history_page_ids_[2]); | |
1834 EXPECT_EQ(expected_page_id_2, view()->history_page_ids_[3]); | |
1835 } | 1576 } |
1836 | 1577 |
1837 TEST_F(RenderViewImplTest, ContextMenu) { | 1578 TEST_F(RenderViewImplTest, ContextMenu) { |
1838 LoadHTML("<div>Page A</div>"); | 1579 LoadHTML("<div>Page A</div>"); |
1839 | 1580 |
1840 // Create a right click in the center of the iframe. (I'm hoping this will | 1581 // Create a right click in the center of the iframe. (I'm hoping this will |
1841 // make this a bit more robust in case of some other formatting or other bug.) | 1582 // make this a bit more robust in case of some other formatting or other bug.) |
1842 WebMouseEvent mouse_event; | 1583 WebMouseEvent mouse_event; |
1843 mouse_event.type = WebInputEvent::MouseDown; | 1584 mouse_event.type = WebInputEvent::MouseDown; |
1844 mouse_event.button = WebMouseEvent::ButtonRight; | 1585 mouse_event.button = WebMouseEvent::ButtonRight; |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2494 | 2235 |
2495 gfx::Size initial_size_; | 2236 gfx::Size initial_size_; |
2496 }; | 2237 }; |
2497 | 2238 |
2498 TEST_F(RenderViewImplInitialSizeTest, InitialSize) { | 2239 TEST_F(RenderViewImplInitialSizeTest, InitialSize) { |
2499 ASSERT_EQ(initial_size_, view_->GetSize()); | 2240 ASSERT_EQ(initial_size_, view_->GetSize()); |
2500 ASSERT_EQ(initial_size_, gfx::Size(view_->GetWebView()->size())); | 2241 ASSERT_EQ(initial_size_, gfx::Size(view_->GetWebView()->size())); |
2501 } | 2242 } |
2502 | 2243 |
2503 } // namespace content | 2244 } // namespace content |
OLD | NEW |