Commit 207e8662 authored by chaopeng's avatar chaopeng Committed by Commit Bot

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/1028835Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: Jianpeng Chao <chaopeng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563421}
parent 329c2a2f
Test ensures that scrollingElement.scrollTop/Left properties are available by the time DOMContentLoaded event fires.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS document.scrollingElement.scrollTop is 2000
PASS document.scrollingElement.scrollLeft is 1000
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<html> <script src='../../resources/testharness.js'></script>
<head> <script src='../../resources/testharnessreport.js'></script>
<script src="../../resources/js-test.js"></script> <script src='../../resources/gesture-util.js'></script>
<script>
description('Test ensures that scrollingElement.scrollTop/Left properties are available by the time DOMContentLoaded event fires.'); <style>
#overflow {
width: 9999px;
height: 9999px;
float: left;
}
</style>
<div id='overflow'></div>
<script>
// Navigation steps: // Navigation steps:
// 1- page gets first loaded and scrolled. // 1- page gets first loaded and scrolled.
// 2- loaded page away and then 'back'. // 2- loaded page away and then 'back'.
// Test: ensure that by the time DOMContenLoaded fires (after a back navigation), scrollingElement.scrollTop/Left are set. // Test: ensure that by the time DOMContenLoaded fires (after a back navigation), scrollingElement.scrollTop/Left are set.
function init(evt) { 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') { if (window.name == 'second/load') {
shouldBe('document.scrollingElement.scrollTop', '2000'); assert_equals(document.scrollingElement.scrollTop, 2000);
shouldBe('document.scrollingElement.scrollLeft', '1000'); assert_equals(document.scrollingElement.scrollLeft, 1000);
window.name = ""; window.name = '';
if (window.testRunner) t.done();
finishJSTest();
} else { } else {
window.scrollTo(1000, 2000); window.scrollTo(1000, 2000);
window.name = "second/load"; window.name = 'second/load';
} setTimeout(() => { window.location = '../../resources/back.html'; }, 0);
} }
function onLoad() { });
setTimeout('window.location = "../../resources/back.html"', 0);
} }
window.addEventListener('DOMContentLoaded', init, true); window.addEventListener('DOMContentLoaded', init, true);
window.onunload = function() {} // prevent caching </script>
\ No newline at end of file
var jsTestIsAsync = true;
</script>
<body onload="onLoad()">
<div id="overflow" style='width: 9999px; height:9999px; float:left;'></div>
<h1 id='console'/>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment