Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../http/tests/inspector/inspector-test.js"></script> |
| 4 <script> | 4 <script> |
| 5 | 5 |
| 6 if (window.testRunner) | 6 if (window.testRunner) { |
| 7 window.testRunner.disableMockScreenOrientation(); | 7 window.testRunner.disableMockScreenOrientation(); |
| 8 window.testRunner.setDumpConsoleMessages(false); | |
| 9 } | |
| 8 | 10 |
| 9 var windowOrientationChangeEvent = false; | 11 var windowOrientationChangeEvent = false; |
| 10 var screenOrientationChangeEvent = false; | 12 var screenOrientationChangeEvent = false; |
| 11 | 13 |
| 12 window.addEventListener("orientationchange", function() { windowOrientationChang eEvent = true; maybeLog(); }); | 14 window.addEventListener("orientationchange", function() { windowOrientationChang eEvent = true; maybeLog(); }); |
| 13 screen.orientation.addEventListener("change", function() { screenOrientationChan geEvent = true; maybeLog(); }); | 15 screen.orientation.addEventListener("change", function() { screenOrientationChan geEvent = true; maybeLog(); }); |
| 14 | 16 |
| 15 function dump() | 17 function dump() |
| 16 { | 18 { |
| 17 return "angle: " + screen.orientation.angle + "; type: " + screen.orientatio n.type; | 19 return "angle: " + screen.orientation.angle + "; type: " + screen.orientatio n.type; |
| 18 } | 20 } |
| 19 | 21 |
| 20 function maybeLog() | 22 function maybeLog() |
| 21 { | 23 { |
| 22 if (windowOrientationChangeEvent && screenOrientationChangeEvent) { | 24 if (windowOrientationChangeEvent && screenOrientationChangeEvent) { |
| 23 windowOrientationChangeEvent = false; | 25 windowOrientationChangeEvent = false; |
| 24 screenOrientationChangeEvent = false; | 26 screenOrientationChangeEvent = false; |
| 25 console.log(dump()); | 27 console.log(dump()); |
|
lushnikov
2017/04/07 22:19:46
can we rather kill this all logic for dumping?
dgozman
2017/04/07 22:29:05
Sounds like extra movement for no benefit.
| |
| 26 } | 28 } |
| 27 } | 29 } |
| 28 | 30 |
| 29 function test() | 31 function test() |
| 30 { | 32 { |
| 31 Protocol.InspectorBackend.Options.suppressRequestErrors = false; | 33 Protocol.InspectorBackend.Options.suppressRequestErrors = false; |
| 32 function addDumpResult(next) | 34 function addDumpResult(next) |
| 33 { | 35 { |
| 34 InspectorTest.evaluateInPage("dump()", dumpCallback); | 36 InspectorTest.evaluateInPage("dump()", dumpCallback); |
| 35 | 37 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 } | 124 } |
| 123 ]); | 125 ]); |
| 124 } | 126 } |
| 125 </script> | 127 </script> |
| 126 </head> | 128 </head> |
| 127 <body onload="runTest()"> | 129 <body onload="runTest()"> |
| 128 <p> | 130 <p> |
| 129 </p> | 131 </p> |
| 130 </body> | 132 </body> |
| 131 </html> | 133 </html> |
| OLD | NEW |