| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 | |
| 4 <script src="../../http/tests/inspector/inspector-test.js"></script> | |
| 5 <script src="../../http/tests/inspector/elements-test.js"></script> | |
| 6 <script src="device-emulation-test.js"></script> | |
| 7 | |
| 8 <script> | |
| 9 // This test is based on http://jsbin.com/urowoh/latest. | |
| 10 setMetaViewport(); | |
| 11 </script> | |
| 12 | |
| 13 <style> | |
| 14 html { | |
| 15 overflow-x: hidden; | |
| 16 } | |
| 17 | |
| 18 body { | |
| 19 margin: 0; | |
| 20 min-height: 1000px; | |
| 21 overflow-x: hidden; | |
| 22 } | |
| 23 </style> | |
| 24 | |
| 25 <script> | |
| 26 function test() | |
| 27 { | |
| 28 InspectorTest._deviceEmulationPageUrl = "device-emulation-restore.html"; | |
| 29 InspectorTest._deviceEmulationResults = []; | |
| 30 var originalMetrics; | |
| 31 | |
| 32 InspectorTest.applyEmulationAndReload(false, 0, 0, 1, "none", null, undefine
d, InspectorTest.getPageMetrics.bind(InspectorTest, true, saveMetrics)); | |
| 33 | |
| 34 function saveMetrics(metrics) | |
| 35 { | |
| 36 originalMetrics = metrics.value; | |
| 37 InspectorTest.emulateAndGetMetrics(1200, 1000, 1, "w=320", null, undefin
ed, restore); | |
| 38 } | |
| 39 | |
| 40 function restore() | |
| 41 { | |
| 42 function callback(metrics) | |
| 43 { | |
| 44 metrics = metrics.value; | |
| 45 if (metrics != originalMetrics) | |
| 46 InspectorTest._deviceEmulationResults.push("Original metrics not
restored.\n==== Original ===\n" + originalMetrics + "\n==== Restored ====\n" +
metrics); | |
| 47 else | |
| 48 InspectorTest._deviceEmulationResults.push("Original metrics res
tored correctly."); | |
| 49 InspectorTest.addResult(InspectorTest._deviceEmulationResults.join("
\n")); | |
| 50 InspectorTest.completeTest(); | |
| 51 } | |
| 52 | |
| 53 InspectorTest.applyEmulationAndReload(false, 0, 0, 1, "none", null, unde
fined, InspectorTest.getPageMetrics.bind(InspectorTest, true, callback)); | |
| 54 } | |
| 55 } | |
| 56 </script> | |
| 57 | |
| 58 </head> | |
| 59 <body onload="runTest()"> | |
| 60 <p> | |
| 61 Tests that disabling device emulation restores back to original values. | |
| 62 </p> | |
| 63 </body> | |
| 64 </html> | |
| OLD | NEW |