forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert scroll-position-restored-on-back-at-load-event.html to new style
It can fix the leak by convert test to new style. Bug: 835802 Change-Id: Icb8efd927fc0e8fc8301be6b7c1c0efd9ed51504 Reviewed-on: https://chromium-review.googlesource.com/1028835 Reviewed-by: David Bokan <bokan@chromium.org> Commit-Queue: Jianpeng Chao <chaopeng@chromium.org> Cr-Commit-Position: refs/heads/master@{#563421}
- Loading branch information
Showing
2 changed files
with
41 additions
and
52 deletions.
There are no files selected for viewing
14 changes: 0 additions & 14 deletions
14
...ebKit/LayoutTests/fast/loader/scroll-position-restored-on-back-at-load-event-expected.txt
This file was deleted.
Oops, something went wrong.
79 changes: 41 additions & 38 deletions
79
..._party/WebKit/LayoutTests/fast/loader/scroll-position-restored-on-back-at-load-event.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test.js"></script> | ||
<script> | ||
description('Test ensures that scrollingElement.scrollTop/Left properties are available by the time DOMContentLoaded event fires.'); | ||
// Navigation steps: | ||
// 1- page gets first loaded and scrolled. | ||
// 2- loaded page away and then 'back'. | ||
// Test: ensure that by the time DOMContenLoaded fires (after a back navigation), scrollingElement.scrollTop/Left are set. | ||
|
||
function init(evt) { | ||
if (window.name == 'second/load') { | ||
shouldBe('document.scrollingElement.scrollTop', '2000'); | ||
shouldBe('document.scrollingElement.scrollLeft', '1000'); | ||
window.name = ""; | ||
|
||
if (window.testRunner) | ||
finishJSTest(); | ||
} else { | ||
window.scrollTo(1000, 2000); | ||
|
||
window.name = "second/load"; | ||
} | ||
} | ||
function onLoad() { | ||
setTimeout('window.location = "../../resources/back.html"', 0); | ||
} | ||
|
||
window.addEventListener('DOMContentLoaded', init, true); | ||
window.onunload = function() {} // prevent caching | ||
|
||
var jsTestIsAsync = true; | ||
</script> | ||
<body onload="onLoad()"> | ||
<div id="overflow" style='width: 9999px; height:9999px; float:left;'></div> | ||
<h1 id='console'/> | ||
</body> | ||
</html> | ||
<script src='../../resources/testharness.js'></script> | ||
<script src='../../resources/testharnessreport.js'></script> | ||
<script src='../../resources/gesture-util.js'></script> | ||
|
||
<style> | ||
#overflow { | ||
width: 9999px; | ||
height: 9999px; | ||
float: left; | ||
} | ||
</style> | ||
|
||
<div id='overflow'></div> | ||
|
||
<script> | ||
// Navigation steps: | ||
// 1- page gets first loaded and scrolled. | ||
// 2- loaded page away and then 'back'. | ||
// Test: ensure that by the time DOMContenLoaded fires (after a back navigation), scrollingElement.scrollTop/Left are set. | ||
|
||
let t = async_test('Test ensures that scrollingElement.scrollTop/Left properties are available by the time DOMContentLoaded event fires.'); | ||
|
||
function init() { | ||
t.step(() => { | ||
if (window.name == 'second/load') { | ||
assert_equals(document.scrollingElement.scrollTop, 2000); | ||
assert_equals(document.scrollingElement.scrollLeft, 1000); | ||
window.name = ''; | ||
|
||
t.done(); | ||
} else { | ||
window.scrollTo(1000, 2000); | ||
|
||
window.name = 'second/load'; | ||
setTimeout(() => { window.location = '../../resources/back.html'; }, 0); | ||
} | ||
}); | ||
} | ||
|
||
window.addEventListener('DOMContentLoaded', init, true); | ||
</script> |