15abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrickdescription('Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present.');
24e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block
34e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Blockfunction hasDeviceOrientationEventProperty()
44e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block{
54e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block    for (var property in window) {
65abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        if (property == 'DeviceOrientationEvent')
74e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block            return true;
84e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block    }
94e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block    return false;
104e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block}
114e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block
120617145a89917ae7735fe1c9538688ab9a577df5Kristian MonsenshouldBeTrue("typeof window.DeviceOrientationEvent == 'object'");
130617145a89917ae7735fe1c9538688ab9a577df5Kristian MonsenshouldBeFalse("typeof window.DeviceOrientationEvent == 'function'");
144e1f8b9c727ac820b633f6de547dc9afcd8da485Steve BlockshouldBeTrue("hasDeviceOrientationEventProperty()");
154e1f8b9c727ac820b633f6de547dc9afcd8da485Steve BlockshouldBeTrue("'DeviceOrientationEvent' in window");
164e1f8b9c727ac820b633f6de547dc9afcd8da485Steve BlockshouldBeTrue("window.hasOwnProperty('DeviceOrientationEvent')");
174e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block
184e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Blockfunction hasOnDeviceOrientationProperty()
194e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block{
204e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block    for (var property in window) {
215abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306Iain Merrick        if (property == 'ondeviceorientation')
224e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block            return true;
234e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block    }
244e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block    return false;
254e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block}
264e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block
274e1f8b9c727ac820b633f6de547dc9afcd8da485Steve BlockshouldBeTrue("typeof window.ondeviceorientation == 'object'");
284e1f8b9c727ac820b633f6de547dc9afcd8da485Steve BlockshouldBeTrue("hasOnDeviceOrientationProperty()");
294e1f8b9c727ac820b633f6de547dc9afcd8da485Steve BlockshouldBeTrue("'ondeviceorientation' in window");
300617145a89917ae7735fe1c9538688ab9a577df5Kristian MonsenshouldBeTrue("window.hasOwnProperty('ondeviceorientation')");
314e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Block
324e1f8b9c727ac820b633f6de547dc9afcd8da485Steve Blockwindow.successfullyParsed = true;
33