1 description("Tests that the window.DeviceMotionEvent and window.ondevicemotion properties are present."); 2 3 function hasDeviceMotionEventProperty() 4 { 5 for (var property in window) { 6 if (property == "DeviceMotionEvent") 7 return true; 8 } 9 return false; 10 } 11 12 shouldBeTrue("typeof window.DeviceMotionEvent == 'object'"); 13 shouldBeFalse("typeof window.DeviceMotionEvent == 'function'"); 14 shouldBeTrue("hasDeviceMotionEventProperty()"); 15 shouldBeTrue("'DeviceMotionEvent' in window"); 16 shouldBeTrue("window.hasOwnProperty('DeviceMotionEvent')"); 17 18 function hasOnDeviceMotionProperty() 19 { 20 for (var property in window) { 21 if (property == "ondevicemotion") 22 return true; 23 } 24 return false; 25 } 26 27 shouldBeTrue("typeof window.ondevicemotion == 'object'"); 28 shouldBeTrue("hasOnDeviceMotionProperty()"); 29 shouldBeTrue("'ondevicemotion' in window"); 30 shouldBeTrue("window.hasOwnProperty('ondevicemotion')"); 31 32 window.successfullyParsed = true; 33