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

Side by Side Diff: LayoutTests/fast/loader/stateobjects/popstate-fires-with-page-cache.html

Issue 14495004: Remove left-over PageCache stuff (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../js/resources/js-test-pre.js"></script>
5 <div id="description"></div>
6 <pre id="console"></pre>
7 <script>
8 description('Tests that popstate events fire when navigating between pages (and history entries created via pushState) that are in the page cache.');
9
10 var testWindow;
11
12 onload = function()
13 {
14 if (window.testRunner) {
15 testRunner.setCanOpenWindows();
16 testRunner.overridePreference('WebKitUsesPageCachePreferenceKey', 1);
17 }
18 testWindow = window.open('resources/popstate-fires-with-page-cache-1.html');
19 if (!testWindow)
20 testFailed('Could not open test window');
21 }
22
23 var testWindowPopstateFireCount = 0;
24
25 function onTestWindowPopState(event)
26 {
27 debug('popstate fired with state ' + event.state);
28 testWindowPopstateFireCount++;
29
30 switch (testWindowPopstateFireCount) {
31 case 1:
32 debug('pushState with new state object for page 1');
33 testWindow.history.pushState('newState');
34 debug('going to page 2');
35 // Set the location in a timeout to generate a history entry
36 setTimeout(function() {testWindow.location.href = 'resources/popstat e-fires-with-page-cache-2.html';}, 0);
37 break;
38 case 2:
39 debug('going back to page 1 with new state object');
40 setTimeout(function() {testWindow.history.back();}, 0);
41 break;
42 case 3:
43 debug('going back to page 1 in initial state');
44 setTimeout(function() {testWindow.history.back();}, 0);
45 break;
46 case 4:
47 // Close the window in a timeout to simulate popstate firing asynchr onously, otherwise closing the window in a popstate handler results in a crash.
48 // FIXME: remove this when http://webkit.org/b/36202 is fixed.
49 setTimeout(function() {
50 testWindow.close();
51 finishJSTest();
52 }, 0);
53 break;
54 default:
55 testFailed('unexpected pop state event state');
56 break;
57 }
58 }
59 var jsTestIsAsync = true;
60 </script>
61 <script src="../../js/resources/js-test-post.js"></script>
62 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698