<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body onload="setTimeout(runTest, 1)">
<p>Test to restore form value states for a radio group.</p>
<div id="console"></div>
<input id=emptyOnFirstVisit>
<div id=parent>
<form action="../../../resources/back.html" id=form1>
<input name=user type=radio id=input1>
<input checked name=user type=radio id=input2>
</form>
</div>
<script>
window.jsTestIsAsync = true;
function runTest() {
var parent = document.getElementById('parent');
var state = document.getElementById('emptyOnFirstVisit');
if (!state.value) {
// First visit.
state.value = 'visited';
document.getElementById('input1').checked = true;
// Submit form in a timeout to make sure that we create a new back/forward list item.
setTimeout(function() {document.getElementById('form1').submit();}, 0);
} else {
// Second visit.
shouldBeTrue('document.getElementById("input1").checked');
shouldBeFalse('document.getElementById("input2").checked');
finishJSTest();
}
}
</script>
</body>