blob: b576eb641e26e82facc85f9026b1cc7bb7a61bb3 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Old Powerful Features on an Insecure Origin</title>
</head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/get-host-info.js"></script>
<body>
<div id="target"></div>
<script>
if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
window.location = get_host_info().UNAUTHENTICATED_ORIGIN + window.location.pathname;
} else {
if (!window.internals)
assert_unreached('window.internals is required for this test');
var mockLatitude = 51.478;
var mockLongitude = -0.166;
var mockAccuracy = 100.0;
internals.setGeolocationClientMock(document);
internals.setGeolocationPermission(document, true);
internals.setGeolocationPosition(document,
mockLatitude,
mockLongitude,
mockAccuracy);
// Tests for APIs that are deprecated, but still allowed, on
// insecure origins
async_test(function() {
navigator.geolocation.getCurrentPosition(
this.step_func(function() {
this.done();
}),
this.step_func(function(error) {
assert_unreached('getCurrentPosition should succeed, but failed.');
this.done();
}));
}, 'getCurrentPosition');
// Note that the deprecation message for watchPosition() will be supressed
// because it is an exact duplicate of the getCurrentPosition() message.
// Thus, this test is really to confirm that it still executes.
async_test(function() {
navigator.geolocation.watchPosition(
this.step_func(function() {
this.done();
}),
this.step_func(function(error) {
assert_unreached('watchPosition should succeed, but failed.');
this.done();
}));
}, 'watchPosition');
async_test(function() {
var element = document.getElementById('target');
document.addEventListener('fullscreenerror', this.step_func(function(e) {
assert_unreached('requestFullscreen should succeed, but failed.');
this.done();
}));
document.addEventListener('fullscreenchange', this.step_func(function() {
this.done();
}));
var request = element.requestFullscreen.bind(element);
document.addEventListener("click", request);
eventSender.mouseDown();
eventSender.mouseUp();
document.removeEventListener("click", request);
}, 'fullscreen');
async_test(function() {
testRunner.setMockDeviceMotion(true, 0, true, 0, true, 0,
true, 0, true, 0, true, 0,
true, 0, true, 0, true, 0,
0);
window.addEventListener('devicemotion', this.step_func(function() {
this.done();
}));
}, 'device motion');
async_test(function() {
testRunner.setMockDeviceOrientation(11.1, 22.2, 33.3, true);
window.addEventListener('deviceorientation', this.step_func(function() {
this.done();
}));
}, 'device orientation');
promise_test(function(test) {
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
}, 'requestMediaKeySystemAccess');
// Tests for APIs that have been turned off on insecure origins
async_test(function() {
navigator.webkitGetUserMedia({ audio: true, video: true },
this.unreached_func('getUserMedia should call the error callback, but called the success callback instead.'),
this.step_func_done());
}, 'getUserMedia');
}
</script>
</body>
</html>