Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(837)

Side by Side Diff: LayoutTests/inspector/screen-orientation-override.html

Issue 1195793008: [DevTools] Implement screen orientation override. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 if (!window.testRunner)
7 debug("This test requires testRunner");
8
9 function dump()
10 {
11 return "angle: " + screen.orientation.angle + "; type: " + screen.orientatio n.type;
12 }
13
14 function setup()
15 {
16 if (window.testRunner)
17 testRunner.setMockScreenOrientation("landscape-primary");
18 return dump();
19 }
20
21 function test()
22 {
23 function testOverride(angle, orientation, next)
24 {
25 if (orientation) {
26 InspectorTest.ScreenOrientationAgent.setScreenOrientationOverride(ang le, orientation, protocolCallback);
27 } else {
28 InspectorTest.ScreenOrientationAgent.clearScreenOrientationOverride( protocolCallback);
29 }
30
31 function protocolCallback()
32 {
33 InspectorTest.evaluateInPage("dump()", dumpCallback);
34 }
35
36 function dumpCallback(result)
37 {
38 InspectorTest.addResult(result.value);
39 next();
40 }
41 }
42
43 InspectorTest.runTestSuite([
44 function setUp(next)
45 {
46 InspectorTest.evaluateInPage("setup()", callback);
47
48 function callback(result)
49 {
50 InspectorTest.addResult(result.value);
51 next();
52 }
53 },
54
55 function setPortraitPrimary(next)
56 {
57 testOverride(0, "portraitPrimary", next);
58 },
59
60 function setPortraitSecondary(next)
61 {
62 testOverride(180, "portraitSecondary", next);
63 },
64
65 function setLandscapePrimary(next)
66 {
67 testOverride(90, "landscapePrimary", next);
68 },
69
70 function setLandscapeSecondary(next)
71 {
72 testOverride(270, "landscapeSecondary", next);
73 },
74
75 function clearOverride(next)
76 {
77 testOverride(0, "", next);
78 }
79 ]);
80 }
81 </script>
82 </head>
83 <body onload="runTest()">
84 <p>
85 </p>
86 </body>
87 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698