diff options
author | Steve Block <steveblock@google.com> | 2010-07-27 04:44:36 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-07-27 04:44:36 -0700 |
commit | 767966411f0c19c445f74d2ff90ab9490c290026 (patch) | |
tree | 68d92b5845011e5cd5fd2f16c2f01c5b66e504ef | |
parent | 5d853cd4d75f62072f2d56d4e6665b05703b31f5 (diff) | |
parent | 4e1f8b9c727ac820b633f6de547dc9afcd8da485 (diff) | |
download | external_webkit-767966411f0c19c445f74d2ff90ab9490c290026.zip external_webkit-767966411f0c19c445f74d2ff90ab9490c290026.tar.gz external_webkit-767966411f0c19c445f74d2ff90ab9490c290026.tar.bz2 |
Merge "Add DeviceOrientation LayoutTests at r63859 and enable the feature"
12 files changed, 235 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/DeviceOrientation/create-event-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/create-event-expected.txt new file mode 100644 index 0000000..33cf12b --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/create-event-expected.txt @@ -0,0 +1,22 @@ +Tests that document.createEvent() works with DeviceOrientationEvent. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS typeof event == 'object' is true +PASS 'type' in event is true +PASS 'bubbles' in event is true +PASS 'cancelable' in event is true +PASS 'alpha' in event is true +PASS 'beta' in event is true +PASS 'gamma' in event is true +PASS typeof event.type == 'string' is true +PASS typeof event.bubbles == 'boolean' is true +PASS typeof event.cancelable == 'boolean' is true +PASS typeof event.alpha == 'object' is true +PASS typeof event.beta == 'object' is true +PASS typeof event.gamma == 'object' is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/create-event.html b/LayoutTests/fast/dom/DeviceOrientation/create-event.html new file mode 100644 index 0000000..545f962 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/create-event.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/create-event.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/optional-event-properties-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/optional-event-properties-expected.txt new file mode 100644 index 0000000..cd0e933 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/optional-event-properties-expected.txt @@ -0,0 +1,37 @@ +Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +event = document.createEvent('DeviceOrientationEvent') +PASS event.alpha == null is true +PASS event.beta == null is true +PASS event.gamma == null is true +event.initDeviceOrientationEvent('', false, false, 0, 1, 2) +PASS event.alpha == 0 is true +PASS event.beta == 1 is true +PASS event.gamma == 2 is true +event.initDeviceOrientationEvent() +PASS event.alpha == null is true +PASS event.beta == null is true +PASS event.gamma == null is true +event.initDeviceOrientationEvent('', false, false, [], [], []) +PASS event.alpha == 0 is true +PASS event.beta == 0 is true +PASS event.gamma == 0 is true +event.initDeviceOrientationEvent('', false, false, undefined, undefined, undefined) +PASS event.alpha == null is true +PASS event.beta == null is true +PASS event.gamma == null is true +event.initDeviceOrientationEvent('', false, false, '', '', '') +PASS event.alpha == 0 is true +PASS event.beta == 0 is true +PASS event.gamma == 0 is true +event.initDeviceOrientationEvent('', false, false, null, null, null) +PASS event.alpha == null is true +PASS event.beta == null is true +PASS event.gamma == null is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/optional-event-properties.html b/LayoutTests/fast/dom/DeviceOrientation/optional-event-properties.html new file mode 100644 index 0000000..212669f --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/optional-event-properties.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/optional-event-properties.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html new file mode 100644 index 0000000..b31963d --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/TEMPLATE.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="YOUR_JS_FILE_HERE"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js new file mode 100644 index 0000000..0fe8774 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js @@ -0,0 +1,21 @@ +description("Tests that document.createEvent() works with DeviceOrientationEvent."); + +var event = document.createEvent('DeviceOrientationEvent'); + +shouldBeTrue("typeof event == 'object'"); + +shouldBeTrue("'type' in event"); +shouldBeTrue("'bubbles' in event"); +shouldBeTrue("'cancelable' in event"); +shouldBeTrue("'alpha' in event"); +shouldBeTrue("'beta' in event"); +shouldBeTrue("'gamma' in event"); + +shouldBeTrue("typeof event.type == 'string'"); +shouldBeTrue("typeof event.bubbles == 'boolean'"); +shouldBeTrue("typeof event.cancelable == 'boolean'"); +shouldBeTrue("typeof event.alpha == 'object'"); +shouldBeTrue("typeof event.beta == 'object'"); +shouldBeTrue("typeof event.gamma == 'object'"); + +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js new file mode 100644 index 0000000..2936e72 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js @@ -0,0 +1,40 @@ +description("Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined."); + +var event; + +evalAndLog("event = document.createEvent('DeviceOrientationEvent')"); +shouldBeTrue("event.alpha == null"); +shouldBeTrue("event.beta == null"); +shouldBeTrue("event.gamma == null"); + +evalAndLog("event.initDeviceOrientationEvent('', false, false, 0, 1, 2)"); +shouldBeTrue("event.alpha == 0"); +shouldBeTrue("event.beta == 1"); +shouldBeTrue("event.gamma == 2"); + +evalAndLog("event.initDeviceOrientationEvent()"); +shouldBeTrue("event.alpha == null"); +shouldBeTrue("event.beta == null"); +shouldBeTrue("event.gamma == null"); + +evalAndLog("event.initDeviceOrientationEvent('', false, false, [], [], [])"); +shouldBeTrue("event.alpha == 0"); +shouldBeTrue("event.beta == 0"); +shouldBeTrue("event.gamma == 0"); + +evalAndLog("event.initDeviceOrientationEvent('', false, false, undefined, undefined, undefined)"); +shouldBeTrue("event.alpha == null"); +shouldBeTrue("event.beta == null"); +shouldBeTrue("event.gamma == null"); + +evalAndLog("event.initDeviceOrientationEvent('', false, false, '', '', '')"); +shouldBeTrue("event.alpha == 0"); +shouldBeTrue("event.beta == 0"); +shouldBeTrue("event.gamma == 0"); + +evalAndLog("event.initDeviceOrientationEvent('', false, false, null, null, null)"); +shouldBeTrue("event.alpha == null"); +shouldBeTrue("event.beta == null"); +shouldBeTrue("event.gamma == null"); + +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js new file mode 100644 index 0000000..e7458b4 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js @@ -0,0 +1,31 @@ +description("Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present."); + +function hasDeviceOrientationEventProperty() +{ + for (var property in window) { + if (property == "DeviceOrientationEvent") + return true; + } + return false; +} + +shouldBeTrue("typeof window.DeviceOrientationEvent == 'function'"); +shouldBeTrue("hasDeviceOrientationEventProperty()"); +shouldBeTrue("'DeviceOrientationEvent' in window"); +shouldBeTrue("window.hasOwnProperty('DeviceOrientationEvent')"); + +function hasOnDeviceOrientationProperty() +{ + for (var property in window) { + if (property == "ondeviceorientation") + return true; + } + return false; +} + +shouldBeTrue("typeof window.ondeviceorientation == 'object'"); +shouldBeTrue("hasOnDeviceOrientationProperty()"); +shouldBeTrue("'ondeviceorientation' in window"); +shouldBeFalse("window.hasOwnProperty('ondeviceorientation')"); + +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/window-property-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/window-property-expected.txt new file mode 100644 index 0000000..95075a0 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/window-property-expected.txt @@ -0,0 +1,17 @@ +Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS typeof window.DeviceOrientationEvent == 'function' is true +PASS hasDeviceOrientationEventProperty() is true +PASS 'DeviceOrientationEvent' in window is true +PASS window.hasOwnProperty('DeviceOrientationEvent') is true +PASS typeof window.ondeviceorientation == 'object' is true +PASS hasOnDeviceOrientationProperty() is true +PASS 'ondeviceorientation' in window is true +PASS window.hasOwnProperty('ondeviceorientation') is false +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/window-property.html b/LayoutTests/fast/dom/DeviceOrientation/window-property.html new file mode 100644 index 0000000..e122033 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/window-property.html @@ -0,0 +1,12 @@ +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/window-property.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/platform/android-jsc/fast/dom/DeviceOrientation/window-property-expected.txt b/LayoutTests/platform/android-jsc/fast/dom/DeviceOrientation/window-property-expected.txt new file mode 100644 index 0000000..6288f30 --- /dev/null +++ b/LayoutTests/platform/android-jsc/fast/dom/DeviceOrientation/window-property-expected.txt @@ -0,0 +1,17 @@ +Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +FAIL typeof window.DeviceOrientationEvent == 'function' should be true. Was false. +PASS hasDeviceOrientationEventProperty() is true +PASS 'DeviceOrientationEvent' in window is true +PASS window.hasOwnProperty('DeviceOrientationEvent') is true +PASS typeof window.ondeviceorientation == 'object' is true +PASS hasOnDeviceOrientationProperty() is true +PASS 'ondeviceorientation' in window is true +FAIL window.hasOwnProperty('ondeviceorientation') should be false. Was true. +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/WebCore/config.h b/WebCore/config.h index df4d06b..5d5c6c1 100644 --- a/WebCore/config.h +++ b/WebCore/config.h @@ -123,6 +123,8 @@ #undef ENABLE_INSPECTOR // Enabled by default in Platform.h #define ENABLE_INSPECTOR 0 #define ENABLE_EVENT_SOURCE 0 +#define ENABLE_DEVICE_ORIENTATION 1 + #undef ENABLE_APPLICATION_INSTALLED #define ENABLE_APPLICATION_INSTALLED 1 |