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 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 900)); | 1270 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 900)); |
1271 LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); | 1271 LocalFrame* mainFrameLocal = toLocalFrame(webViewImpl->page()->mainFrame()); |
1272 Persistent<HistoryItem> item1 = mainFrameLocal->loader().currentItem(); | 1272 Persistent<HistoryItem> item1 = mainFrameLocal->loader().currentItem(); |
1273 | 1273 |
1274 // Click an anchor | 1274 // Click an anchor |
1275 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#a")))); | 1275 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#a")))); |
1276 Persistent<HistoryItem> item2 = mainFrameLocal->loader().currentItem(); | 1276 Persistent<HistoryItem> item2 = mainFrameLocal->loader().currentItem(); |
1277 | 1277 |
1278 // Go back, then forward, then back again. | 1278 // Go back, then forward, then back again. |
1279 mainFrameLocal->loader().load( | 1279 mainFrameLocal->loader().load( |
1280 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( | 1280 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem(it
em1.get(), WebCachePolicy::UseProtocolCachePolicy)), |
1281 item1.get(), UseProtocolCachePolicy)), | |
1282 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); | 1281 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); |
1283 mainFrameLocal->loader().load( | 1282 mainFrameLocal->loader().load( |
1284 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( | 1283 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem(it
em2.get(), WebCachePolicy::UseProtocolCachePolicy)), |
1285 item2.get(), UseProtocolCachePolicy)), | |
1286 FrameLoadTypeBackForward, item2.get(), HistorySameDocumentLoad); | 1284 FrameLoadTypeBackForward, item2.get(), HistorySameDocumentLoad); |
1287 mainFrameLocal->loader().load( | 1285 mainFrameLocal->loader().load( |
1288 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( | 1286 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem(it
em1.get(), WebCachePolicy::UseProtocolCachePolicy)), |
1289 item1.get(), UseProtocolCachePolicy)), | |
1290 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); | 1287 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); |
1291 | 1288 |
1292 // Click a different anchor | 1289 // Click a different anchor |
1293 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#b")))); | 1290 mainFrameLocal->loader().load(FrameLoadRequest(mainFrameLocal->document(), R
esourceRequest(mainFrameLocal->document()->completeURL("#b")))); |
1294 Persistent<HistoryItem> item3 = mainFrameLocal->loader().currentItem(); | 1291 Persistent<HistoryItem> item3 = mainFrameLocal->loader().currentItem(); |
1295 | 1292 |
1296 // Go back, then forward. The scroll position should be properly set on the
forward navigation. | 1293 // Go back, then forward. The scroll position should be properly set on the
forward navigation. |
1297 mainFrameLocal->loader().load( | 1294 mainFrameLocal->loader().load( |
1298 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( | 1295 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem(it
em1.get(), WebCachePolicy::UseProtocolCachePolicy)), |
1299 item1.get(), UseProtocolCachePolicy)), | |
1300 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); | 1296 FrameLoadTypeBackForward, item1.get(), HistorySameDocumentLoad); |
1301 mainFrameLocal->loader().load( | 1297 mainFrameLocal->loader().load( |
1302 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem( | 1298 FrameLoadRequest(nullptr, FrameLoader::resourceRequestFromHistoryItem(it
em3.get(), WebCachePolicy::UseProtocolCachePolicy)), |
1303 item3.get(), UseProtocolCachePolicy)), | |
1304 FrameLoadTypeBackForward, item3.get(), HistorySameDocumentLoad); | 1299 FrameLoadTypeBackForward, item3.get(), HistorySameDocumentLoad); |
1305 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); | 1300 EXPECT_EQ(0, webViewImpl->mainFrame()->scrollOffset().width); |
1306 EXPECT_GT(webViewImpl->mainFrame()->scrollOffset().height, 2000); | 1301 EXPECT_GT(webViewImpl->mainFrame()->scrollOffset().height, 2000); |
1307 } | 1302 } |
1308 | 1303 |
1309 TEST_F(WebViewTest, EnterFullscreenResetScrollAndScaleState) | 1304 TEST_F(WebViewTest, EnterFullscreenResetScrollAndScaleState) |
1310 { | 1305 { |
1311 FrameTestHelpers::TestWebViewClient client; | 1306 FrameTestHelpers::TestWebViewClient client; |
1312 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); | 1307 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), WebString::fromUTF8("200-by-300.html")); |
1313 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html", true, 0, &client); | 1308 WebViewImpl* webViewImpl = m_webViewHelper.initializeAndLoad(m_baseURL + "20
0-by-300.html", true, 0, &client); |
(...skipping 1982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3296 frame->setAutofillClient(&client); | 3291 frame->setAutofillClient(&client); |
3297 webView->setInitialFocus(false); | 3292 webView->setInitialFocus(false); |
3298 | 3293 |
3299 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3294 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
3300 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3295 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
3301 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3296 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
3302 frame->setAutofillClient(0); | 3297 frame->setAutofillClient(0); |
3303 } | 3298 } |
3304 | 3299 |
3305 } // namespace blink | 3300 } // namespace blink |
OLD | NEW |