Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: Source/web/tests/WebViewTest.cpp

Issue 1156473002: Refactor FrameLoader loading interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/web/tests/WebFrameTest.cpp ('k') | public/web/WebFrameLoadType.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
1188 // Emulate a user scroll 1188 // Emulate a user scroll
1189 webViewImpl->mainFrame()->setScrollOffset(WebSize(0, 900)); 1189 webViewImpl->mainFrame()->setScrollOffset(WebSize(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 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
3029 for (size_t i = 0; i < renders.size(); ++i) { 3044 for (size_t i = 0; i < renders.size(); ++i) {
3030 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0; 3045 double docStartTime = frame->domWindow()->document()->loader()->timing() .monotonicTimeToZeroBasedDocumentTime(renderPairs[i].startTime) * 1000.0;
3031 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime()); 3046 ASSERT_DOUBLE_EQ(docStartTime, renders[i]->startTime());
3032 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0; 3047 double docFinishTime = frame->domWindow()->document()->loader()->timing( ).monotonicTimeToZeroBasedDocumentTime(renderPairs[i].finishTime) * 1000.0;
3033 double docDuration = docFinishTime - docStartTime; 3048 double docDuration = docFinishTime - docStartTime;
3034 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration()); 3049 ASSERT_DOUBLE_EQ(docDuration, renders[i]->duration());
3035 } 3050 }
3036 } 3051 }
3037 3052
3038 } // namespace 3053 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/WebFrameTest.cpp ('k') | public/web/WebFrameLoadType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698