summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js
blob: 885932bd6035ec22513c0bfc2fbfaa271bc6b487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
description('Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present.');

function hasDeviceOrientationEventProperty()
{
    for (var property in window) {
        if (property == 'DeviceOrientationEvent')
            return true;
    }
    return false;
}

shouldBeTrue("typeof window.DeviceOrientationEvent == 'object'");
shouldBeFalse("typeof window.DeviceOrientationEvent == 'function'");
shouldBeTrue("hasDeviceOrientationEventProperty()");
shouldBeTrue("'DeviceOrientationEvent' in window");
shouldBeTrue("window.hasOwnProperty('DeviceOrientationEvent')");

function hasOnDeviceOrientationProperty()
{
    for (var property in window) {
        if (property == 'ondeviceorientation')
            return true;
    }
    return false;
}

shouldBeTrue("typeof window.ondeviceorientation == 'object'");
shouldBeTrue("hasOnDeviceOrientationProperty()");
shouldBeTrue("'ondeviceorientation' in window");
shouldBeTrue("window.hasOwnProperty('ondeviceorientation')");

window.successfullyParsed = true;