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

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: Restore test Created 5 years, 5 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 if (window.testRunner)
15 testRunner.setMockScreenOrientation("landscape-primary");
16
17 function test()
18 {
19 function addDumpResult(next)
20 {
21 InspectorTest.evaluateInPage("dump()", dumpCallback);
22
23 function dumpCallback(result)
24 {
25 InspectorTest.addResult(result.value);
26 next();
27 }
28 }
29
30 function testOverride(angle, orientation, next)
31 {
32 var protocolCallback = addDumpResult.bind(null, next);
33 if (orientation) {
34 InspectorTest.ScreenOrientationAgent.setScreenOrientationOverride(ang le, orientation, protocolCallback);
35 } else {
36 InspectorTest.ScreenOrientationAgent.clearScreenOrientationOverride( protocolCallback);
37 }
38 }
39
40 function testError(angle, orientation, next)
41 {
42 InspectorTest.ScreenOrientationAgent.setScreenOrientationOverride(angle, orientation, protocolCallback);
43
44 function protocolCallback(error)
45 {
46 InspectorTest.addResult(error);
47 next();
48 }
49 }
50
51 InspectorTest.runTestSuite([
52 function initial(next)
53 {
54 addDumpResult(next);
55 },
56
57 function setWrongAngle1(next)
58 {
59 testError(-1, "portraitPrimary", next);
60 },
61
62 function setWrongAngle2(next)
63 {
64 testError(360, "portraitPrimary", next);
65 },
66
67 function setWrongType(next)
68 {
69 testError(120, "wrongType", next);
70 },
71
72 function setPortraitPrimary(next)
73 {
74 testOverride(0, "portraitPrimary", next);
75 },
76
77 function setPortraitSecondary(next)
78 {
79 testOverride(180, "portraitSecondary", next);
80 },
81
82 function setLandscapePrimary(next)
83 {
84 testOverride(90, "landscapePrimary", next);
85 },
86
87 function restoresAfterReload(next)
88 {
89 InspectorTest.reloadPage(addDumpResult.bind(null, next));
90 },
91
92 function setLandscapeSecondary(next)
93 {
94 testOverride(270, "landscapeSecondary", next);
95 },
96
97 function clearOverride(next)
98 {
99 testOverride(0, "", next);
100 }
101 ]);
102 }
103 </script>
104 </head>
105 <body onload="runTest()">
106 <p>
107 </p>
108 </body>
109 </html>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/inspector/inspector-test.js ('k') | LayoutTests/inspector/screen-orientation-override-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698