Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320)
[chromium-blink-merge.git] / content / test / data / device_sensors / device_orientation_test.html
blob95c68f553c86354602c867cdda05f1491caef544
1 <html>
2 <head>
3 <title>DeviceOrientation test</title>
4 <script type="text/javascript">
5 var eventCount = 0;
7 function checkOrientationEvent(event) {
8 // Return true iff the orientation is close enough to (1, 2, 3).
9 return Math.abs(event.alpha - 1) < 0.01 &&
10 Math.abs(event.beta - 2) < 0.01 &&
11 Math.abs(event.gamma - 3) < 0.01;
14 function onOrientation(event) {
15 if (checkOrientationEvent(event)) {
16 window.removeEventListener('deviceorientation', onOrientation);
17 pass();
18 } else {
19 fail();
23 function pass() {
24 document.getElementById('status').innerHTML = 'PASS';
25 document.location = '#pass';
28 function fail() {
29 document.location = '#fail';
31 </script>
32 </head>
33 <body onLoad="window.addEventListener('deviceorientation', onOrientation)">
34 <div id="status">FAIL</div>
35 </body>
36 </html>