blob: cc09269a4a5ca7e87224923a00e70509bec39db8 [file] [log] [blame]
<!-- webkit-test-runner [ UsesBackForwardCache=true ] -->
<!DOCTYPE html>
<html>
<body>
<script src='/js-test-resources/js-test.js'></script>
<script src='/js-test-resources/ui-helper.js'></script>
<script>
description('Tests that a page with an active ApplePaySession goes into the back/forward cache.');
window.jsTestIsAsync = true;
window.addEventListener('pageshow', function(event) {
debug('pageshow - ' + (event.persisted ? '' : 'not ') + 'from cache');
if (event.persisted) {
testPassed('Page did enter and was restored from the back/forward cache');
}
}, false);
window.addEventListener('pagehide', function(event) {
debug('pagehide - ' + (event.persisted ? '' : 'not ') + 'entering cache');
if (!event.persisted) {
testFailed('Page failed to enter the back/forward cache.');
finishJSTest();
}
}, false);
window.addEventListener('load', function() {
UIHelper.withUserGesture(function() {
session = new ApplePaySession(1, {
countryCode: 'US',
currencyCode: 'USD',
supportedNetworks: ['visa', 'masterCard'],
merchantCapabilities: ['supports3DS'],
total: { label: 'Total', amount: '1.00' },
});
session.begin();
});
session.addEventListener('cancel', function() {
testPassed('ApplePaySession received a cancel event.');
finishJSTest();
});
setTimeout(function() {
window.location.href = '/navigation/resources/page-cache-helper.html';
}, 0);
}, false);
</script>
</body>
</html>