summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/DeviceMotion/script-tests/window-property.js
blob: 3d22ba855e4dcd982c80c436fcdbe180bc53a586 (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.DeviceMotionEvent and window.ondevicemotion properties are present.");

function hasDeviceMotionEventProperty()
{
    for (var property in window) {
        if (property == "DeviceMotionEvent")
            return true;
    }
    return false;
}

shouldBeTrue("typeof window.DeviceMotionEvent == 'object'");
shouldBeFalse("typeof window.DeviceMotionEvent == 'function'");
shouldBeTrue("hasDeviceMotionEventProperty()");
shouldBeTrue("'DeviceMotionEvent' in window");
shouldBeTrue("window.hasOwnProperty('DeviceMotionEvent')");

function hasOnDeviceMotionProperty()
{
    for (var property in window) {
        if (property == "ondevicemotion")
            return true;
    }
    return false;
}

shouldBeTrue("typeof window.ondevicemotion == 'object'");
shouldBeTrue("hasOnDeviceMotionProperty()");
shouldBeTrue("'ondevicemotion' in window");
shouldBeTrue("window.hasOwnProperty('ondevicemotion')");

window.successfullyParsed = true;