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

Unified Diff: LayoutTests/screen_orientation/orientation-attribute.html

Issue 366853008: [screen-orientation] Expose orientation info in OrientationInformation interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update ctor listing Created 6 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/screen_orientation/orientation-attribute.html
diff --git a/LayoutTests/screen_orientation/orientation-attribute.html b/LayoutTests/screen_orientation/orientation-attribute.html
index 312f33393f7f59f5b576db6ff72d157f1c2898b2..79bffed7d4d5b34a351e56d6f03d7d67ea40e4cb 100644
--- a/LayoutTests/screen_orientation/orientation-attribute.html
+++ b/LayoutTests/screen_orientation/orientation-attribute.html
@@ -1,12 +1,50 @@
<!DOCTYPE html>
<html>
<body>
-<script src="../resources/js-test.js"></script>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
<script>
-description("Basic test that accesses screen.orientation.");
-shouldBeEqualToString("screen.orientation", "portrait-primary");
+test(function() {
+ assert_true('type' in screen.orientation);
+ assert_true('angle' in screen.orientation);
+}, "Test screen.orientation properties");
+
+test(function() {
+ assert_equals(screen.orientation.type, "portrait-primary");
+ assert_equals(screen.orientation.angle, 0);
+}, "Test screen.orientation default values.");
+
+test(function() {
+ var type = screen.orientation.type;
+ var angle = screen.orientation.angle;
+
+ screen.orientation.type = 'foo';
+ screen.orientation.angle = 42;
+
+ assert_equals(screen.orientation.type, type);
+ assert_equals(screen.orientation.angle, angle);
+}, "Test that screen.orientation properties are not writable");
+
+test(function() {
+ assert_equals(screen.orientation, screen.orientation);
+}, "Test that screen.orientation is always the same object");
+
+test(function() {
+ var orientation = screen.orientation;
+ var orientationType = screen.orientation.type;
+ var orientationAngle = screen.orientation.angle;
+
+ if (window.testRunner)
+ window.testRunner.setMockScreenOrientation('landscape-primary');
+
+ assert_equals(screen.orientation, orientation);
+ assert_equals(screen.orientation.type, orientation.type);
+ assert_equals(screen.orientation.angle, orientation.angle);
+ assert_not_equals(screen.orientation.type, orientationType);
+ assert_not_equals(screen.orientation.angle, orientationAngle);
+}, "Test that screen.orientation values change if the orientation changes");
+
</script>
</body>
</html>
-

Powered by Google App Engine
This is Rietveld 408576698