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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 // Emulate a user scroll | 1188 // Emulate a user scroll |
1189 webViewImpl->setMainFrameScrollOffset(WebPoint(0, 900)); | 1189 webViewImpl->setMainFrameScrollOffset(WebPoint(0, 900)); |
1190 LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); | 1190 LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); |
1191 RefPtrWillBePersistent<HistoryItem> item1 = mainFrameLocal->loader().current
Item(); | 1191 RefPtrWillBePersistent<HistoryItem> item1 = mainFrameLocal->loader().current
Item(); |
1192 | 1192 |
1193 // Click an anchor | 1193 // Click an anchor |
1194 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#a")))); | 1194 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#a")))); |
1195 RefPtrWillBePersistent<HistoryItem> item2 = mainFrameLocal->loader().current
Item(); | 1195 RefPtrWillBePersistent<HistoryItem> item2 = mainFrameLocal->loader().current
Item(); |
1196 | 1196 |
1197 // Go back, then forward, then back again. | 1197 // Go back, then forward, then back again. |
1198 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 1198 mainFrameLocal->loader().load( |
1199 mainFrameLocal->loader().loadHistoryItem(item2.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 1199 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( |
1200 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 1200 item1.get(), UseProtocolCachePolicy)), |
| 1201 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); |
| 1202 mainFrameLocal->loader().load( |
| 1203 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( |
| 1204 item2.get(), UseProtocolCachePolicy)), |
| 1205 FrameLoadTypeBackForward, item2.get(), HistorySameDocumentLoad); |
| 1206 mainFrameLocal->loader().load( |
| 1207 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( |
| 1208 item1.get(), UseProtocolCachePolicy)), |
| 1209 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); |
1201 | 1210 |
1202 // Click a different anchor | 1211 // Click a different anchor |
1203 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#b")))); | 1212 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#b")))); |
1204 RefPtrWillBePersistent<HistoryItem> item3 = mainFrameLocal->loader().current
Item(); | 1213 RefPtrWillBePersistent<HistoryItem> item3 = mainFrameLocal->loader().current
Item(); |
1205 | 1214 |
1206 // Go back, then forward. The scroll position should be properly set on the
forward navigation. | 1215 // Go back, then forward. The scroll position should be properly set on the
forward navigation. |
1207 mainFrameLocal->loader().loadHistoryItem(item1.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 1216 mainFrameLocal->loader().load( |
1208 mainFrameLocal->loader().loadHistoryItem(item3.get(), FrameLoadTypeBackForwa
rd, HistorySameDocumentLoad); | 1217 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( |
| 1218 item1.get(), UseProtocolCachePolicy)), |
| 1219 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); |
| 1220 mainFrameLocal->loader().load( |
| 1221 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( |
| 1222 item3.get(), UseProtocolCachePolicy)), |
| 1223 FrameLoadTypeBackForward, item3.get(), HistorySameDocumentLoad); |
1209 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); | 1224 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); |
1210 EXPECT_GT(webViewImpl->mainFrame()->scrollOffset().height, 2000); | 1225 EXPECT_GT(webViewImpl->mainFrame()->scrollOffset().height, 2000); |
1211 } | 1226 } |
1212 | 1227 |
1213 TEST_F(WebViewTest, EnterFullscreenResetScrollAndScaleState) | 1228 TEST_F(WebViewTest, EnterFullscreenResetScrollAndScaleState) |
1214 { | 1229 { |
1215 FrameTestHelpers::TestWebViewClient client; | 1230 FrameTestHelpers::TestWebViewClient client; |
1216 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); | 1231 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
1217 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html", true, 0, &client); | 1232 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html", true, 0, &client); |
1218 webViewImpl->resize(WebSize(100, 150)); | 1233 webViewImpl->resize(WebSize(100, 150)); |
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3017 for (size_t i = 0; i < renders.size(); ++i) { | 3032 for (size_t i = 0; i < renders.size(); ++i) { |
3018 double docStartTime = frame->domWindow()->document()->loader()->timing()
.monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; | 3033 double docStartTime = frame->domWindow()->document()->loader()->timing()
.monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; |
3019 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); | 3034 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); |
3020 double docFinishTime = frame->domWindow()->document()->loader()->timing(
).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; | 3035 double docFinishTime = frame->domWindow()->document()->loader()->timing(
).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; |
3021 double docDuration = docFinishTime - docStartTime; | 3036 double docDuration = docFinishTime - docStartTime; |
3022 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); | 3037 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); |
3023 } | 3038 } |
3024 } | 3039 } |
3025 | 3040 |
3026 } // namespace | 3041 } // namespace |
OLD | NEW |