OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 TEST_F(WebViewTest, BackForwardRestoreScroll) | 884 TEST_F(WebViewTest, BackForwardRestoreScroll) |
885 { | 885 { |
886 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("back_forward_restore_scroll.html")); | 886 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("back_forward_restore_scroll.html")); |
887 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "ba
ck_forward_restore_scroll.html"); | 887 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "ba
ck_forward_restore_scroll.html"); |
888 webViewImpl->resize(WebSize(640, 480)); | 888 webViewImpl->resize(WebSize(640, 480)); |
889 webViewImpl->layout(); | 889 webViewImpl->layout(); |
890 | 890 |
891 // Emulate a user scroll | 891 // Emulate a user scroll |
892 webViewImpl->setMainFrameScrollOffset(WebPoint(0, 900)); | 892 webViewImpl->setMainFrameScrollOffset(WebPoint(0, 900)); |
893 LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); | 893 LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); |
894 RefPtr<HistoryItem> item1 = mainFrameLocal->loader().currentItem(); | 894 RefPtrWillBePersistent<HistoryItem> item1 = mainFrameLocal->loader().current
Item(); |
895 | 895 |
896 // Click an anchor | 896 // Click an anchor |
897 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#a")))); | 897 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#a")))); |
898 RefPtr<HistoryItem> item2 = mainFrameLocal->loader().currentItem(); | 898 RefPtrWillBePersistent<HistoryItem> item2 = mainFrameLocal->loader().current
Item(); |
899 | 899 |
900 // Go back, then forward, then back again. | 900 // Go back, then forward, then back again. |
901 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 901 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); |
902 mainFrameLocal->loader().loadHistoryItem(item2.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 902 mainFrameLocal->loader().loadHistoryItem(item2.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); |
903 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 903 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); |
904 | 904 |
905 // Click a different anchor | 905 // Click a different anchor |
906 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#b")))); | 906 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#b")))); |
907 RefPtr<HistoryItem> item3 = mainFrameLocal->loader().currentItem(); | 907 RefPtrWillBePersistent<HistoryItem> item3 = mainFrameLocal->loader().current
Item(); |
908 | 908 |
909 // Go back, then forward. The scroll position should be properly set on the
forward navigation. | 909 // Go back, then forward. The scroll position should be properly set on the
forward navigation. |
910 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 910 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); |
911 mainFrameLocal->loader().loadHistoryItem(item3.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 911 mainFrameLocal->loader().loadHistoryItem(item3.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); |
912 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); | 912 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); |
913 EXPECT_GT(webViewImpl->mainFrame()->scrollOffset().height, 2000); | 913 EXPECT_GT(webViewImpl->mainFrame()->scrollOffset().height, 2000); |
914 } | 914 } |
915 | 915 |
916 class EnterFullscreenWebViewClient : public FrameTestHelpers::TestWebViewClient
{ | 916 class EnterFullscreenWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
917 public: | 917 public: |
(...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2216 loadFrame(webView->mainFrame(), url); | 2216 loadFrame(webView->mainFrame(), url); |
2217 | 2217 |
2218 FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl()->frame
View(); | 2218 FrameView* frameView = m_webViewHelper.webViewImpl()->mainFrameImpl()->frame
View(); |
2219 | 2219 |
2220 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T
his EXPECT is | 2220 // Auto-resizing used to ASSERT(needsLayout()) in RenderBlockFlow::layout. T
his EXPECT is |
2221 // merely a dummy. The real test is that we don't trigger asserts in debug b
uilds. | 2221 // merely a dummy. The real test is that we don't trigger asserts in debug b
uilds. |
2222 EXPECT_FALSE(frameView->needsLayout()); | 2222 EXPECT_FALSE(frameView->needsLayout()); |
2223 }; | 2223 }; |
2224 | 2224 |
2225 } // namespace | 2225 } // namespace |
OLD | NEW |