Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / screen_orientation / orientation-reading.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/testharness.js"></script>
5 <script src="../resources/testharnessreport.js"></script>
6 <script>
7
8 test(function() {
9     assert_true('type' in screen.orientation);
10     assert_true('angle' in screen.orientation);
11 }, "Test screen.orientation properties");
12
13 test(function() {
14     assert_equals(screen.orientation.type, "portrait-primary");
15     assert_equals(screen.orientation.angle, 0);
16 }, "Test screen.orientation default values.");
17
18 test(function() {
19     var type = screen.orientation.type;
20     var angle = screen.orientation.angle;
21
22     screen.orientation.type = 'foo';
23     screen.orientation.angle = 42;
24
25     assert_equals(screen.orientation.type, type);
26     assert_equals(screen.orientation.angle, angle);
27 }, "Test that screen.orientation properties are not writable");
28
29 test(function() {
30     assert_equals(screen.orientation, screen.orientation);
31 }, "Test that screen.orientation is always the same object");
32
33 test(function() {
34     var orientation = screen.orientation;
35     var orientationType = screen.orientation.type;
36     var orientationAngle = screen.orientation.angle;
37
38     if (window.testRunner)
39         window.testRunner.setMockScreenOrientation('landscape-primary');
40
41     assert_equals(screen.orientation, orientation);
42     assert_equals(screen.orientation.type, orientation.type);
43     assert_equals(screen.orientation.angle, orientation.angle);
44     assert_not_equals(screen.orientation.type, orientationType);
45     assert_not_equals(screen.orientation.angle, orientationAngle);
46 }, "Test that screen.orientation values change if the orientation changes");
47
48 </script>
49 </body>
50 </html>