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