diff options
author | Iain Merrick <husky@google.com> | 2010-09-13 16:35:48 +0100 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-09-16 12:10:42 +0100 |
commit | 5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306 (patch) | |
tree | ddce1aa5e3b6967a69691892e500897558ff8ab6 /LayoutTests | |
parent | 12bec63ec71e46baba27f0bd9bd9d8067683690a (diff) | |
download | external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.zip external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.gz external_webkit-5abb8606fa57c3ebfc8b3c3dbc3fa4a25d2ae306.tar.bz2 |
Merge WebKit at r67178 : Initial merge by git.
Change-Id: I57e01163b6866cb029cdadf405a0394a3918bc18
Diffstat (limited to 'LayoutTests')
38 files changed, 914 insertions, 413 deletions
diff --git a/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt new file mode 100644 index 0000000..6bf84d4 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback-expected.txt @@ -0,0 +1,18 @@ +Tests that adding a new event listener from a callback works as expected. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback.html b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback.html new file mode 100644 index 0000000..fa338f5 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/add-listener-from-callback.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/add-listener-from-callback.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/multiple-frames-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames-expected.txt new file mode 100644 index 0000000..5f24e38 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames-expected.txt @@ -0,0 +1,15 @@ +Tests using DeviceOrientation from multiple frames. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/multiple-frames.html b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames.html new file mode 100644 index 0000000..f0e1e89 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/multiple-frames.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/multiple-frames.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events-expected.txt new file mode 100644 index 0000000..0d95dee --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events-expected.txt @@ -0,0 +1,10 @@ +Tests that events are never fired sycnhronously from a call to window.addEventListener(). + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS hasAddEventListenerReturned is true +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events.html b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events.html new file mode 100644 index 0000000..23ce6b2 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/no-synchronous-events.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/no-synchronous-events.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/null-values-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/null-values-expected.txt new file mode 100644 index 0000000..cb739ae --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/null-values-expected.txt @@ -0,0 +1,21 @@ +Tests using null values for some of the event properties. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/null-values.html b/LayoutTests/fast/dom/DeviceOrientation/null-values.html new file mode 100644 index 0000000..d21463c --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/null-values.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/null-values.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js new file mode 100644 index 0000000..381b89c --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/add-listener-from-callback.js @@ -0,0 +1,48 @@ +description('Tests that adding a new event listener from a callback works as expected.'); + +var mockEvent; +function setMockOrientation(alpha, beta, gamma) { + mockEvent = {alpha: alpha, beta: beta, gamma: gamma}; + if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, mockEvent.alpha, true, mockEvent.beta, true, mockEvent.gamma); + else + debug('This test can not be run without the LayoutTestController'); +} + +var deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +var firstListenerEvents = 0; +function firstListener(event) { + checkOrientation(event); + if (++firstListenerEvents == 1) + setMockOrientation(11.1, 22.2, 33.3); + else if (firstListenerEvents > 2) + testFailed('Too many events for first listener.'); + window.addEventListener('deviceorientation', secondListener); + maybeFinishTest(); +} + +var secondListenerEvents = 0; +function secondListener(event) { + checkOrientation(event); + if (++secondListenerEvents > 1) + testFailed('Too many events for second listener.'); + maybeFinishTest(); +} + +function maybeFinishTest() { + if (firstListenerEvents == 2 && secondListenerEvents == 1) + finishJSTest(); +} + +setMockOrientation(1.1, 2.2, 3.3); +window.addEventListener('deviceorientation', firstListener); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js index 6e68b06..b5ff5ba 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/basic-operation.js @@ -1,4 +1,4 @@ -description("Tests the basic operation of DeviceOrientation using the mock."); +description('Tests the basic operation of DeviceOrientation using the mock.'); var mockAlpha = 1.1; var mockBeta = 2.2; @@ -10,7 +10,7 @@ else debug('This test can not be run without the LayoutTestController'); var deviceOrientationEvent; -window.addEventListener("deviceorientation", function(e) { +window.addEventListener('deviceorientation', function(e) { deviceOrientationEvent = e; shouldBe('deviceOrientationEvent.alpha', 'mockAlpha'); shouldBe('deviceOrientationEvent.beta', 'mockBeta'); diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js index 0fe8774..706de70 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/create-event.js @@ -1,4 +1,4 @@ -description("Tests that document.createEvent() works with DeviceOrientationEvent."); +description('Tests that document.createEvent() works with DeviceOrientationEvent.'); var event = document.createEvent('DeviceOrientationEvent'); diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/multiple-frames.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/multiple-frames.js new file mode 100644 index 0000000..f8b8fb9 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/multiple-frames.js @@ -0,0 +1,43 @@ +description('Tests using DeviceOrientation from multiple frames.'); + +var deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +var hasMainFrameEventFired = false; +function mainFrameListener(event) { + checkOrientation(event); + hasMainFrameEventFired = true; + maybeFinishTest(); +} + +var hasChildFrameEventFired = false; +function childFrameListener(event) { + checkOrientation(event); + hasChildFrameEventFired = true; + maybeFinishTest(); +} + +function maybeFinishTest() { + if (hasMainFrameEventFired && hasChildFrameEventFired) + finishJSTest(); +} + +var mockEvent = {alpha: 1.1, beta: 2.2, gamma: 3.3}; +if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, mockEvent.alpha, true, mockEvent.beta, true, mockEvent.gamma); +else + debug('This test can not be run without the LayoutTestController'); + +var childFrame = document.createElement('iframe'); +document.body.appendChild(childFrame); +childFrame.contentWindow.addEventListener('deviceorientation', childFrameListener); + +window.addEventListener('deviceorientation', mainFrameListener); + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-synchronous-events.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-synchronous-events.js new file mode 100644 index 0000000..0f4bc51 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/no-synchronous-events.js @@ -0,0 +1,16 @@ +description('Tests that events are never fired sycnhronously from a call to window.addEventListener().'); + +if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, 1.1, true, 2.2, true, 3.3); +else + debug('This test can not be run without the LayoutTestController'); + +var hasAddEventListenerReturned = false; +window.addEventListener('deviceorientation', function() { + shouldBeTrue('hasAddEventListenerReturned'); + finishJSTest(); +}); +hasAddEventListenerReturned = true; + +window.jsTestIsAsync = true; +window.successfullyParsed = true; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js new file mode 100644 index 0000000..ccde66a --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/null-values.js @@ -0,0 +1,56 @@ +description('Tests using null values for some of the event properties.'); + +var mockEvent; +function setMockOrientation(alpha, beta, gamma) { + mockEvent = {alpha: alpha, beta: beta, gamma: gamma}; + if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation( + null != mockEvent.alpha, null == mockEvent.alpha ? 0 : mockEvent.alpha, + null != mockEvent.beta, null == mockEvent.beta ? 0 : mockEvent.beta, + null != mockEvent.gamma, null == mockEvent.gamma ? 0 : mockEvent.gamma); + else + debug('This test can not be run without the LayoutTestController'); +} + +var deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +function firstListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', firstListener); + + setMockOrientation(1.1, null, null); + window.addEventListener('deviceorientation', secondListener); +} + +function secondListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', secondListener); + + setMockOrientation(null, 2.2, null); + window.addEventListener('deviceorientation', thirdListener); +} + +function thirdListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', thirdListener); + + setMockOrientation(null, null, 3.3); + window.addEventListener('deviceorientation', fourthListener); +} + +function fourthListener(event) { + checkOrientation(event); + finishJSTest(); +} + +setMockOrientation(null, null, null); +window.addEventListener('deviceorientation', firstListener); + +window.jsTestIsAsync = true; +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 index 2936e72..900c94b 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/optional-event-properties.js @@ -1,4 +1,4 @@ -description("Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined."); +description('Tests the optional properties of DeviceOrientationEvent. Each property should be null if not set, or set to null or undefined.'); var event; diff --git a/LayoutTests/fast/dom/DeviceOrientation/script-tests/updates.js b/LayoutTests/fast/dom/DeviceOrientation/script-tests/updates.js new file mode 100644 index 0000000..f5ec029 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/updates.js @@ -0,0 +1,37 @@ +description('Tests that updates to the orientation causes new events to fire.'); + +var mockEvent; +function setMockOrientation(alpha, beta, gamma) { + mockEvent = {alpha: alpha, beta: beta, gamma: gamma}; + if (window.layoutTestController) + layoutTestController.setMockDeviceOrientation(true, mockEvent.alpha, true, mockEvent.beta, true, mockEvent.gamma); + else + debug('This test can not be run without the LayoutTestController'); +} + +var deviceOrientationEvent; +function checkOrientation(event) { + deviceOrientationEvent = event; + shouldBe('deviceOrientationEvent.alpha', 'mockEvent.alpha'); + shouldBe('deviceOrientationEvent.beta', 'mockEvent.beta'); + shouldBe('deviceOrientationEvent.gamma', 'mockEvent.gamma'); +} + +function firstListener(event) { + checkOrientation(event); + window.removeEventListener('deviceorientation', firstListener); + + setMockOrientation(11.1, 22.2, 33.3); + window.addEventListener('deviceorientation', updateListener); +} + +function updateListener(event) { + checkOrientation(event); + finishJSTest(); +} + +setMockOrientation(1.1, 2.2, 3.3); +window.addEventListener('deviceorientation', firstListener); + +window.jsTestIsAsync = true; +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 index 8e65059..885932b 100644 --- a/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js +++ b/LayoutTests/fast/dom/DeviceOrientation/script-tests/window-property.js @@ -1,9 +1,9 @@ -description("Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present."); +description('Tests that the window.DeviceOrientationEvent and window.ondeviceorientation properties are present.'); function hasDeviceOrientationEventProperty() { for (var property in window) { - if (property == "DeviceOrientationEvent") + if (property == 'DeviceOrientationEvent') return true; } return false; @@ -18,7 +18,7 @@ shouldBeTrue("window.hasOwnProperty('DeviceOrientationEvent')"); function hasOnDeviceOrientationProperty() { for (var property in window) { - if (property == "ondeviceorientation") + if (property == 'ondeviceorientation') return true; } return false; diff --git a/LayoutTests/fast/dom/DeviceOrientation/updates-expected.txt b/LayoutTests/fast/dom/DeviceOrientation/updates-expected.txt new file mode 100644 index 0000000..6e54f16 --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/updates-expected.txt @@ -0,0 +1,15 @@ +Tests that updates to the orientation causes new events to fire. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS deviceOrientationEvent.alpha is mockEvent.alpha +PASS deviceOrientationEvent.beta is mockEvent.beta +PASS deviceOrientationEvent.gamma is mockEvent.gamma +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/DeviceOrientation/updates.html b/LayoutTests/fast/dom/DeviceOrientation/updates.html new file mode 100644 index 0000000..5f2ac3c --- /dev/null +++ b/LayoutTests/fast/dom/DeviceOrientation/updates.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/updates.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js b/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js index c83daa4..af5275d 100644 --- a/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js +++ b/LayoutTests/fast/events/touch/script-tests/send-oncancel-event.js @@ -20,13 +20,15 @@ function touchcancelHandler() { if (window.layoutTestController) window.layoutTestController.waitUntilDone(); -if (window.eventSender) { - document.addEventListener("touchcancel", touchcancelHandler, false); - eventSender.addTouchPoint(touchX, touchY); - eventSender.touchStart(); - eventSender.cancelTouchPoint(0); - eventSender.touchCancel(); -} else - debug("This test requires DumpRenderTree."); +window.onload = function() { + if (window.eventSender) { + document.addEventListener("touchcancel", touchcancelHandler, false); + eventSender.addTouchPoint(touchX, touchY); + eventSender.touchStart(); + eventSender.cancelTouchPoint(0); + eventSender.touchCancel(); + } else + debug("This test requires DumpRenderTree."); +} var successfullyParsed = true; diff --git a/LayoutTests/platform/android/Skipped b/LayoutTests/platform/android/Skipped deleted file mode 100644 index f4ab335..0000000 --- a/LayoutTests/platform/android/Skipped +++ /dev/null @@ -1,2 +0,0 @@ -# Full Screen support is not yet enabled. -fullscreen/ diff --git a/LayoutTests/storage/indexeddb/basics.html b/LayoutTests/storage/indexeddb/basics.html index 24af453..9f5f20f 100644 --- a/LayoutTests/storage/indexeddb/basics.html +++ b/LayoutTests/storage/indexeddb/basics.html @@ -8,6 +8,35 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/basics.js"></script> +<script> + +description("Test IndexedDB's basics."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function openCallback() +{ + verifySuccessEvent(event); + done(); +} + +function test() +{ + shouldBeTrue("'indexedDB' in window"); + shouldBeFalse("indexedDB == null"); + + // FIXME: Verify other IndexedDatabaseRequest constructors, once they're implemented. + + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = openCallback; + result.onerror = unexpectedErrorCallback; +} + +test(); + +var successfullyParsed = true; + +</script> </body> </html> diff --git a/LayoutTests/storage/indexeddb/database-basics-expected.txt b/LayoutTests/storage/indexeddb/database-basics-expected.txt index 1321f4d..fc224cc 100644 --- a/LayoutTests/storage/indexeddb/database-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/database-basics-expected.txt @@ -23,11 +23,6 @@ PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE db = event.result -PASS db.name is "name" -PASS db.objectStores is [] -PASS db.objectStores.length is 0 -PASS db.objectStores.contains('') is false - Testing setVersion. db.setVersion("version a") PASS 'onsuccess' in result is true @@ -36,6 +31,18 @@ PASS 'abort' in result is true PASS 'readyState' in result is true An event should fire shortly... +Success event fired: +PASS 'result' in event is true +PASS 'code' in event is false +PASS 'message' in event is false +PASS 'source' in event is true +PASS event.source != null is true +PASS 'onsuccess' in event.target is true +PASS 'onerror' in event.target is true +PASS 'abort' in event.target is true +PASS 'readyState' in event.target is true +PASS event.target.readyState is event.target.DONE + db.setVersion("version b") PASS 'onsuccess' in result is true PASS 'onerror' in result is true @@ -43,8 +50,47 @@ PASS 'abort' in result is true PASS 'readyState' in result is true An event should fire shortly... +Success event fired: +PASS 'result' in event is true +PASS 'code' in event is false +PASS 'message' in event is false +PASS 'source' in event is true +PASS event.source != null is true +PASS 'onsuccess' in event.target is true +PASS 'onerror' in event.target is true +PASS 'abort' in event.target is true +PASS 'readyState' in event.target is true +PASS event.target.readyState is event.target.DONE + PASS db.version is "version b" +PASS db.name is "name" +PASS db.objectStores is [] +PASS db.objectStores.length is 0 +PASS db.objectStores.contains('') is false +db.createObjectStore("test123") +PASS 'onsuccess' in result is true +PASS 'onerror' in result is true +PASS 'abort' in result is true +PASS 'readyState' in result is true +An event should fire shortly... + +Success event fired: +PASS 'result' in event is true +PASS 'code' in event is false +PASS 'message' in event is false +PASS 'source' in event is true +PASS event.source != null is true +PASS 'onsuccess' in event.target is true +PASS 'onerror' in event.target is true +PASS 'abort' in event.target is true +PASS 'readyState' in event.target is true +PASS event.target.readyState is event.target.DONE + +PASS db.objectStores is ['test123'] +PASS db.objectStores.length is 1 +PASS db.objectStores.contains('') is false +PASS db.objectStores.contains('test456') is false +PASS db.objectStores.contains('test123') is true PASS successfullyParsed is true TEST COMPLETE - diff --git a/LayoutTests/storage/indexeddb/database-basics.html b/LayoutTests/storage/indexeddb/database-basics.html index 9c92194..b099a49 100644 --- a/LayoutTests/storage/indexeddb/database-basics.html +++ b/LayoutTests/storage/indexeddb/database-basics.html @@ -8,6 +8,80 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/database-basics.js"></script> +<script> + +description("Test the basics of IndexedDB's IDBDatabase."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function openSuccess() +{ + verifySuccessEvent(event); + + var db = evalAndLog("db = event.result"); + deleteAllObjectStores(db); + + // We must do something asynchronous before anything synchronous since + // deleteAllObjectStores only schedules the object stores to be removed. + // We don't know for sure whether it's happened until an IDBRequest object + // that was created after the removes fires. + + debug("Testing setVersion."); + result = evalAndLog('db.setVersion("version a")'); + verifyResult(result); + result.onsuccess = setVersionAgain; + result.onError = unexpectedErrorCallback; +} + +function setVersionAgain() +{ + verifySuccessEvent(event); + + result = evalAndLog('db.setVersion("version b")'); + verifyResult(result); + result.onsuccess = createObjectStore; + result.onError = unexpectedErrorCallback; +} + +function createObjectStore() +{ + verifySuccessEvent(event); + shouldBeEqualToString("db.version", "version b"); + shouldBeEqualToString("db.name", "name"); + shouldBe("db.objectStores", "[]"); + shouldBe("db.objectStores.length", "0"); + shouldBe("db.objectStores.contains('')", "false"); + + result = evalAndLog('db.createObjectStore("test123")'); + verifyResult(result); + result.onsuccess = checkObjectStore; + result.onError = unexpectedErrorCallback; +} + +function checkObjectStore() +{ + verifySuccessEvent(event); + shouldBe("db.objectStores", "['test123']"); + shouldBe("db.objectStores.length", "1"); + shouldBe("db.objectStores.contains('')", "false"); + shouldBe("db.objectStores.contains('test456')", "false"); + shouldBe("db.objectStores.contains('test123')", "true"); + + done(); +} + +function test() +{ + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = openSuccess; + result.onerror = unexpectedErrorCallback; +} + +test(); + +var successfullyParsed = true; + +</script> </body> </html> diff --git a/LayoutTests/storage/indexeddb/keyrange-expected.txt b/LayoutTests/storage/indexeddb/keyrange-expected.txt index a510a80..6528a11 100644 --- a/LayoutTests/storage/indexeddb/keyrange-expected.txt +++ b/LayoutTests/storage/indexeddb/keyrange-expected.txt @@ -3,6 +3,33 @@ Test IndexedDB's KeyRange. On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". +PASS 'SINGLE' in IDBKeyRange is true +PASS 'LEFT_OPEN' in IDBKeyRange is true +PASS 'RIGHT_OPEN' in IDBKeyRange is true +PASS 'LEFT_BOUND' in IDBKeyRange is true +PASS 'RIGHT_BOUND' in IDBKeyRange is true +PASS 'left' in IDBKeyRange is false +PASS 'right' in IDBKeyRange is false +PASS 'flags' in IDBKeyRange is false +PASS 'only' in IDBKeyRange is true +PASS 'leftBound' in IDBKeyRange is true +PASS 'rightBound' in IDBKeyRange is true +PASS 'bound' in IDBKeyRange is true + +instance = IDBKeyRange.only(1) +PASS 'SINGLE' in instance is true +PASS 'LEFT_OPEN' in instance is true +PASS 'RIGHT_OPEN' in instance is true +PASS 'LEFT_BOUND' in instance is true +PASS 'RIGHT_BOUND' in instance is true +PASS 'left' in instance is true +PASS 'right' in instance is true +PASS 'flags' in instance is true +PASS 'only' in instance is false +PASS 'leftBound' in instance is false +PASS 'rightBound' in instance is false +PASS 'bound' in instance is false + IDBKeyRange.only(1) PASS keyRange.left is 1 PASS keyRange.right is 1 @@ -117,3 +144,4 @@ PASS rightFlags is keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND PASS successfullyParsed is true TEST COMPLETE + diff --git a/LayoutTests/storage/indexeddb/keyrange.html b/LayoutTests/storage/indexeddb/keyrange.html index d4ef58e..d60cb15 100644 --- a/LayoutTests/storage/indexeddb/keyrange.html +++ b/LayoutTests/storage/indexeddb/keyrange.html @@ -8,6 +8,117 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/keyrange.js"></script> +<script> + +description("Test IndexedDB's KeyRange."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function checkSingleKeyRange(value) +{ + keyRange = evalAndLog("IDBKeyRange.only(" + value + ")"); + shouldBe("keyRange.left", "" + value); + shouldBe("keyRange.right", "" + value); + shouldBe("keyRange.flags", "keyRange.SINGLE"); +} + +function checkLeftBoundKeyRange(value, open) +{ + keyRange = evalAndLog("IDBKeyRange.leftBound(" + value + "," + open + ")"); + shouldBe("keyRange.left", "" + value); + shouldBeNull("keyRange.right"); + shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND"); +} + +function checkRightBoundKeyRange(value, open) +{ + keyRange = evalAndLog("IDBKeyRange.rightBound(" + value + "," + open + ")"); + shouldBe("keyRange.right", "" + value); + shouldBeNull("keyRange.left"); + shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND"); +} + +function checkBoundKeyRange(left, right, openLeft, openRight) +{ + keyRange = evalAndLog("IDBKeyRange.bound(" + left + "," + right + "," + openLeft + "," + openRight + ")"); + shouldBe("keyRange.left", "" + left); + shouldBe("keyRange.right", "" + right); + leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND); + shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND"); + rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND); + shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND"); +} + +function test() +{ + shouldBeTrue("'SINGLE' in IDBKeyRange"); + shouldBeTrue("'LEFT_OPEN' in IDBKeyRange"); + shouldBeTrue("'RIGHT_OPEN' in IDBKeyRange"); + shouldBeTrue("'LEFT_BOUND' in IDBKeyRange"); + shouldBeTrue("'RIGHT_BOUND' in IDBKeyRange"); + shouldBeFalse("'left' in IDBKeyRange"); + shouldBeFalse("'right' in IDBKeyRange"); + shouldBeFalse("'flags' in IDBKeyRange"); + shouldBeTrue("'only' in IDBKeyRange"); + shouldBeTrue("'leftBound' in IDBKeyRange"); + shouldBeTrue("'rightBound' in IDBKeyRange"); + shouldBeTrue("'bound' in IDBKeyRange"); + + debug(""); + + var instance = evalAndLog("instance = IDBKeyRange.only(1)"); + shouldBeTrue("'SINGLE' in instance"); + shouldBeTrue("'LEFT_OPEN' in instance"); + shouldBeTrue("'RIGHT_OPEN' in instance"); + shouldBeTrue("'LEFT_BOUND' in instance"); + shouldBeTrue("'RIGHT_BOUND' in instance"); + shouldBeTrue("'left' in instance"); + shouldBeTrue("'right' in instance"); + shouldBeTrue("'flags' in instance"); + shouldBeFalse("'only' in instance"); + shouldBeFalse("'leftBound' in instance"); + shouldBeFalse("'rightBound' in instance"); + shouldBeFalse("'bound' in instance"); + + debug(""); + + checkSingleKeyRange(1); + checkSingleKeyRange("'a'"); + + checkLeftBoundKeyRange(10, true); + checkLeftBoundKeyRange(11, false); + checkLeftBoundKeyRange(12); + checkLeftBoundKeyRange("'aa'", true); + checkLeftBoundKeyRange("'ab'", false); + checkLeftBoundKeyRange("'ac'"); + + checkRightBoundKeyRange(20, true); + checkRightBoundKeyRange(21, false); + checkRightBoundKeyRange(22); + checkRightBoundKeyRange("'ba'", true); + checkRightBoundKeyRange("'bb'", false); + checkRightBoundKeyRange("'bc'"); + + checkBoundKeyRange(30, 40); + checkBoundKeyRange(31, 41, false, false); + checkBoundKeyRange(32, 42, false, true); + checkBoundKeyRange(33, 43, true, false); + checkBoundKeyRange(34, 44, true, true); + + checkBoundKeyRange("'aaa'", "'aba'", false, false); + checkBoundKeyRange("'aab'", "'abb'"); + checkBoundKeyRange("'aac'", "'abc'", false, false); + checkBoundKeyRange("'aad'", "'abd'", false, true); + checkBoundKeyRange("'aae'", "'abe'", true, false); + checkBoundKeyRange("'aaf'", "'abf'", true, true); + +} + +test(); + +var successfullyParsed = true; +done(); + +</script> </body> </html> diff --git a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt index 105058d..a60e857 100644 --- a/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt +++ b/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt @@ -50,7 +50,28 @@ PASS store.name is "storeName" PASS store.keyPath is null PASS storeNames.contains('storeName') is true PASS storeNames.length is 1 -store.add('value', 'key') +event.result.createIndex('indexName', 'x') +PASS 'onsuccess' in result is true +PASS 'onerror' in result is true +PASS 'abort' in result is true +PASS 'readyState' in result is true +An event should fire shortly... + +addIndexSuccess(): +Success event fired: +PASS 'result' in event is true +PASS 'code' in event is false +PASS 'message' in event is false +PASS 'source' in event is true +PASS event.source != null is true +PASS 'onsuccess' in event.target is true +PASS 'onerror' in event.target is true +PASS 'abort' in event.target is true +PASS 'readyState' in event.target is true +PASS event.target.readyState is event.target.DONE + +PASS event.source.indexNames.contains('indexName') is true +event.source.add({x: 'value'}, 'key') PASS 'onsuccess' in result is true PASS 'onerror' in result is true PASS 'abort' in result is true @@ -92,7 +113,7 @@ PASS 'abort' in event.target is true PASS 'readyState' in event.target is true PASS event.target.readyState is event.target.DONE -PASS event.result is "value" +PASS event.result.x is "value" store = event.source store.remove('key') PASS 'onsuccess' in result is true @@ -118,3 +139,4 @@ PASS event.result is null PASS successfullyParsed is true TEST COMPLETE + diff --git a/LayoutTests/storage/indexeddb/objectstore-basics.html b/LayoutTests/storage/indexeddb/objectstore-basics.html index 09eb68c..8b696c4 100644 --- a/LayoutTests/storage/indexeddb/objectstore-basics.html +++ b/LayoutTests/storage/indexeddb/objectstore-basics.html @@ -8,6 +8,103 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/objectstore-basics.js"></script> +<script> + +description("Test the basics of IndexedDB's IDBObjectStore."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function test() +{ + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = openSuccess; + result.onerror = unexpectedErrorCallback; +} + +function openSuccess() +{ + debug("openSuccess():"); + verifySuccessEvent(event); + db = evalAndLog("db = event.result"); + + deleteAllObjectStores(db); + + result = evalAndLog("db.createObjectStore('storeName', null)"); + verifyResult(result); + result.onsuccess = createSuccess; + result.onerror = unexpectedErrorCallback; +} + +function createSuccess() +{ + debug("createSuccess():"); + verifySuccessEvent(event); + var store = evalAndLog("store = event.result"); + var storeNames = evalAndLog("storeNames = db.objectStores"); + + shouldBeEqualToString("store.name", "storeName"); + shouldBeNull("store.keyPath"); + shouldBe("storeNames.contains('storeName')", "true"); + shouldBe("storeNames.length", "1"); + // FIXME: test all of object store's methods. + + result = evalAndLog("event.result.createIndex('indexName', 'x')"); + verifyResult(result); + result.onsuccess = addIndexSuccess; + result.onerror = unexpectedErrorCallback; +} + +function addIndexSuccess() +{ + debug("addIndexSuccess():"); + verifySuccessEvent(event); + shouldBeTrue("event.source.indexNames.contains('indexName')"); + + result = evalAndLog("event.source.add({x: 'value'}, 'key')"); + verifyResult(result); + result.onsuccess = addSuccess; + result.onerror = unexpectedErrorCallback; +} + +function addSuccess() +{ + debug("addSuccess():"); + verifySuccessEvent(event); + shouldBeEqualToString("event.result", "key"); + var store = evalAndLog("store = event.source"); + + result = evalAndLog("store.get('key')"); + verifyResult(result); + result.onsuccess = getSuccess; + result.onerror = unexpectedErrorCallback; +} + +function getSuccess() +{ + debug("getSuccess():"); + verifySuccessEvent(event); + shouldBeEqualToString("event.result.x", "value"); + var store = evalAndLog("store = event.source"); + + result = evalAndLog("store.remove('key')"); + verifyResult(result); + result.onsuccess = removeSuccess; + result.onerror = unexpectedErrorCallback; +} + +function removeSuccess() +{ + debug("removeSuccess():"); + verifySuccessEvent(event); + shouldBeNull("event.result"); + done(); +} + +test(); + +var successfullyParsed = true; + +</script> </body> </html> diff --git a/LayoutTests/storage/indexeddb/objectstore-cursor.html b/LayoutTests/storage/indexeddb/objectstore-cursor.html index bc69b43..25e9456 100644 --- a/LayoutTests/storage/indexeddb/objectstore-cursor.html +++ b/LayoutTests/storage/indexeddb/objectstore-cursor.html @@ -195,10 +195,7 @@ function cursorIteration() window.expectedIndex = ascending ? expectedIndex+1 : expectedIndex-1; testWithinBounds(); - request = event.result.continue(); - // FIXME: The spec says we should not return an IDBRequest and instead re-use the original request. - request.onsuccess = cursorIteration; - request.onerror = unexpectedErrorCallback; + event.result.continue(); } openDatabase(); // The first step. diff --git a/LayoutTests/storage/indexeddb/open-cursor.html b/LayoutTests/storage/indexeddb/open-cursor.html index f60365d..03d1da0 100644 --- a/LayoutTests/storage/indexeddb/open-cursor.html +++ b/LayoutTests/storage/indexeddb/open-cursor.html @@ -8,6 +8,92 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/open-cursor.js"></script> +<script> + +description("Test IndexedDB's openCursor."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function emptyCursorSuccess() +{ + debug("Empty cursor opened successfully.") + verifySuccessEvent(event); + // FIXME: check that we can iterate the cursor. + done(); +} + +function openEmptyCursor() +{ + debug("Opening an empty cursor."); + keyRange = IDBKeyRange.leftBound("InexistentKey"); + result = evalAndLog("objectStore.openCursor(keyRange)"); + verifyResult(result); + result.onsuccess = emptyCursorSuccess; + result.onerror = unexpectedErrorCallback; +} + +function cursorSuccess() +{ + debug("Cursor opened successfully.") + verifySuccessEvent(event); + // FIXME: check that we can iterate the cursor. + shouldBe("event.result.direction", "0"); + shouldBe("event.result.key", "'myKey'"); + shouldBe("event.result.value", "'myValue'"); + debug(""); + openEmptyCursor(); +} + +function openCursor() +{ + debug("Opening cursor"); + keyRange = IDBKeyRange.leftBound("myKey"); + result = evalAndLog("objectStore.openCursor(keyRange)"); + verifyResult(result); + result.onsuccess = cursorSuccess; + result.onerror = unexpectedErrorCallback; +} + +function populateObjectStore(objectStore) +{ + result = evalAndLog("objectStore.add('myValue', 'myKey')"); + verifyResult(result); + result.onsuccess = openCursor; + result.onerror = unexpectedErrorCallback; +} + +function createObjectStoreSuccess() +{ + verifySuccessEvent(event); + var objectStore = evalAndLog("objectStore = event.result"); + populateObjectStore(objectStore); +} + +function openSuccess() +{ + verifySuccessEvent(event); + var db = evalAndLog("db = event.result"); + + deleteAllObjectStores(db); + + result = evalAndLog("db.createObjectStore('test')"); + verifyResult(result); + result.onsuccess = createObjectStoreSuccess; + result.onerror = unexpectedErrorCallback; +} + +function test() +{ + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = openSuccess; + result.onerror = unexpectedErrorCallback; +} + +test(); + +var successfullyParsed = true; + +</script> </body> </html> diff --git a/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html b/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html deleted file mode 100644 index 865fadb..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html +++ /dev/null @@ -1,13 +0,0 @@ -<html> -<head> -<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css"> -<script src="../../fast/js/resources/js-test-pre.js"></script> -<script src="../../fast/js/resources/js-test-post-function.js"></script> -<script src="resources/shared.js"></script> -</head> -<body> -<p id="description"></p> -<div id="console"></div> -<script src="YOUR_JS_FILE_HERE"></script> -</body> -</html> diff --git a/LayoutTests/storage/indexeddb/script-tests/basics.js b/LayoutTests/storage/indexeddb/script-tests/basics.js deleted file mode 100644 index cebd48f..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/basics.js +++ /dev/null @@ -1,26 +0,0 @@ -description("Test IndexedDB's basics."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function openCallback() -{ - verifySuccessEvent(event); - done(); -} - -function test() -{ - shouldBeTrue("'indexedDB' in window"); - shouldBeFalse("indexedDB == null"); - - // FIXME: Verify other IndexedDatabaseRequest constructors, once they're implemented. - - result = evalAndLog("indexedDB.open('name', 'description')"); - verifyResult(result); - result.onsuccess = openCallback; - result.onerror = unexpectedErrorCallback; -} - -test(); - -var successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/script-tests/database-basics.js b/LayoutTests/storage/indexeddb/script-tests/database-basics.js deleted file mode 100644 index 04ebbd3..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/database-basics.js +++ /dev/null @@ -1,51 +0,0 @@ -description("Test the basics of IndexedDB's IDBDatabase."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function openSuccess() -{ - verifySuccessEvent(event); - - var db = evalAndLog("db = event.result"); - shouldBeEqualToString("db.name", "name"); - shouldBe("db.objectStores", "[]"); - shouldBe("db.objectStores.length", "0"); - shouldBe("db.objectStores.contains('')", "false"); - // FIXME: Test .item() once it's possible to get back a non-empty list. - - // FIXME: Test the other properties of IDBDatabase as they're written. - - debug(""); - debug("Testing setVersion."); - result = evalAndLog('db.setVersion("version a")'); - verifyResult(result); - result.onsuccess = setVersionAgain; - result.onError = unexpectedErrorCallback; -} - -function setVersionAgain() -{ - result = evalAndLog('db.setVersion("version b")'); - verifyResult(result); - result.onsuccess = checkVersion; - result.onError = unexpectedErrorCallback; -} - -function checkVersion() -{ - shouldBeEqualToString("db.version", "version b"); - - done(); -} - -function test() -{ - result = evalAndLog("indexedDB.open('name', 'description')"); - verifyResult(result); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; -} - -test(); - -var successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/script-tests/keyrange.js b/LayoutTests/storage/indexeddb/script-tests/keyrange.js deleted file mode 100644 index 907d817..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/keyrange.js +++ /dev/null @@ -1,76 +0,0 @@ -description("Test IndexedDB's KeyRange."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function checkSingleKeyRange(value) -{ - keyRange = evalAndLog("IDBKeyRange.only(" + value + ")"); - shouldBe("keyRange.left", "" + value); - shouldBe("keyRange.right", "" + value); - shouldBe("keyRange.flags", "keyRange.SINGLE"); -} - -function checkLeftBoundKeyRange(value, open) -{ - keyRange = evalAndLog("IDBKeyRange.leftBound(" + value + "," + open + ")"); - shouldBe("keyRange.left", "" + value); - shouldBeNull("keyRange.right"); - shouldBe("keyRange.flags", open ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND"); -} - -function checkRightBoundKeyRange(value, open) -{ - keyRange = evalAndLog("IDBKeyRange.rightBound(" + value + "," + open + ")"); - shouldBe("keyRange.right", "" + value); - shouldBeNull("keyRange.left"); - shouldBe("keyRange.flags", open ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND"); -} - -function checkBoundKeyRange(left, right, openLeft, openRight) -{ - keyRange = evalAndLog("IDBKeyRange.bound(" + left + "," + right + "," + openLeft + "," + openRight + ")"); - shouldBe("keyRange.left", "" + left); - shouldBe("keyRange.right", "" + right); - leftFlags = keyRange.flags & (keyRange.LEFT_OPEN | keyRange.LEFT_BOUND); - shouldBe("leftFlags", openLeft ? "keyRange.LEFT_OPEN | keyRange.LEFT_BOUND" : "keyRange.LEFT_BOUND"); - rightFlags = keyRange.flags & (keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND); - shouldBe("rightFlags", openRight ? "keyRange.RIGHT_OPEN | keyRange.RIGHT_BOUND" : "keyRange.RIGHT_BOUND"); -} - -function test() -{ - checkSingleKeyRange(1); - checkSingleKeyRange("'a'"); - - checkLeftBoundKeyRange(10, true); - checkLeftBoundKeyRange(11, false); - checkLeftBoundKeyRange(12); - checkLeftBoundKeyRange("'aa'", true); - checkLeftBoundKeyRange("'ab'", false); - checkLeftBoundKeyRange("'ac'"); - - checkRightBoundKeyRange(20, true); - checkRightBoundKeyRange(21, false); - checkRightBoundKeyRange(22); - checkRightBoundKeyRange("'ba'", true); - checkRightBoundKeyRange("'bb'", false); - checkRightBoundKeyRange("'bc'"); - - checkBoundKeyRange(30, 40); - checkBoundKeyRange(31, 41, false, false); - checkBoundKeyRange(32, 42, false, true); - checkBoundKeyRange(33, 43, true, false); - checkBoundKeyRange(34, 44, true, true); - - checkBoundKeyRange("'aaa'", "'aba'", false, false); - checkBoundKeyRange("'aab'", "'abb'"); - checkBoundKeyRange("'aac'", "'abc'", false, false); - checkBoundKeyRange("'aad'", "'abd'", false, true); - checkBoundKeyRange("'aae'", "'abe'", true, false); - checkBoundKeyRange("'aaf'", "'abf'", true, true); -} - -test(); - -var successfullyParsed = true; -done(); diff --git a/LayoutTests/storage/indexeddb/script-tests/objectstore-basics.js b/LayoutTests/storage/indexeddb/script-tests/objectstore-basics.js deleted file mode 100644 index 63675ad..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/objectstore-basics.js +++ /dev/null @@ -1,82 +0,0 @@ -description("Test the basics of IndexedDB's IDBObjectStore."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function test() -{ - result = evalAndLog("indexedDB.open('name', 'description')"); - verifyResult(result); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; -} - -function openSuccess() -{ - debug("openSuccess():"); - verifySuccessEvent(event); - db = evalAndLog("db = event.result"); - - deleteAllObjectStores(db); - - result = evalAndLog("db.createObjectStore('storeName', null)"); - verifyResult(result); - result.onsuccess = createSuccess; - result.onerror = unexpectedErrorCallback; -} - -function createSuccess() -{ - debug("createSuccess():"); - verifySuccessEvent(event); - var store = evalAndLog("store = event.result"); - var storeNames = evalAndLog("storeNames = db.objectStores"); - - shouldBeEqualToString("store.name", "storeName"); - shouldBeNull("store.keyPath"); - shouldBe("storeNames.contains('storeName')", "true"); - shouldBe("storeNames.length", "1"); - // FIXME: test store.indexNames, as well as all object store's methods. - - result = evalAndLog("store.add('value', 'key')"); - verifyResult(result); - result.onsuccess = addSuccess; - result.onerror = unexpectedErrorCallback; -} - -function addSuccess() -{ - debug("addSuccess():"); - verifySuccessEvent(event); - shouldBeEqualToString("event.result", "key"); - var store = evalAndLog("store = event.source"); - - result = evalAndLog("store.get('key')"); - verifyResult(result); - result.onsuccess = getSuccess; - result.onerror = unexpectedErrorCallback; -} - -function getSuccess() -{ - debug("getSuccess():"); - verifySuccessEvent(event); - shouldBeEqualToString("event.result", "value"); - var store = evalAndLog("store = event.source"); - - result = evalAndLog("store.remove('key')"); - verifyResult(result); - result.onsuccess = removeSuccess; - result.onerror = unexpectedErrorCallback; -} - -function removeSuccess() -{ - debug("removeSuccess():"); - verifySuccessEvent(event); - shouldBeNull("event.result"); - done(); -} - -test(); - -var successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/script-tests/open-cursor.js b/LayoutTests/storage/indexeddb/script-tests/open-cursor.js deleted file mode 100644 index 53ea96b..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/open-cursor.js +++ /dev/null @@ -1,83 +0,0 @@ -description("Test IndexedDB's openCursor."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function emptyCursorSuccess() -{ - debug("Empty cursor opened successfully.") - verifySuccessEvent(event); - // FIXME: check that we can iterate the cursor. - done(); -} - -function openEmptyCursor() -{ - debug("Opening an empty cursor."); - keyRange = IDBKeyRange.leftBound("InexistentKey"); - result = evalAndLog("objectStore.openCursor(keyRange)"); - verifyResult(result); - result.onsuccess = emptyCursorSuccess; - result.onerror = unexpectedErrorCallback; -} - -function cursorSuccess() -{ - debug("Cursor opened successfully.") - verifySuccessEvent(event); - // FIXME: check that we can iterate the cursor. - shouldBe("event.result.direction", "0"); - shouldBe("event.result.key", "'myKey'"); - shouldBe("event.result.value", "'myValue'"); - debug(""); - openEmptyCursor(); -} - -function openCursor() -{ - debug("Opening cursor"); - keyRange = IDBKeyRange.leftBound("myKey"); - result = evalAndLog("objectStore.openCursor(keyRange)"); - verifyResult(result); - result.onsuccess = cursorSuccess; - result.onerror = unexpectedErrorCallback; -} - -function populateObjectStore(objectStore) -{ - result = evalAndLog("objectStore.add('myValue', 'myKey')"); - verifyResult(result); - result.onsuccess = openCursor; - result.onerror = unexpectedErrorCallback; -} - -function createObjectStoreSuccess() -{ - verifySuccessEvent(event); - var objectStore = evalAndLog("objectStore = event.result"); - populateObjectStore(objectStore); -} - -function openSuccess() -{ - verifySuccessEvent(event); - var db = evalAndLog("db = event.result"); - - deleteAllObjectStores(db); - - result = evalAndLog("db.createObjectStore('test')"); - verifyResult(result); - result.onsuccess = createObjectStoreSuccess; - result.onerror = unexpectedErrorCallback; -} - -function test() -{ - result = evalAndLog("indexedDB.open('name', 'description')"); - verifyResult(result); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; -} - -test(); - -var successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js b/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js deleted file mode 100644 index 58ac2a7..0000000 --- a/LayoutTests/storage/indexeddb/script-tests/transaction-basics.js +++ /dev/null @@ -1,47 +0,0 @@ -description("Test IndexedDB transaction basics."); -if (window.layoutTestController) - layoutTestController.waitUntilDone(); - -function test() -{ - shouldBeTrue("'indexedDB' in window"); - shouldBeFalse("indexedDB == null"); - - result = evalAndLog("indexedDB.open('name', 'description')"); - verifyResult(result); - result.onsuccess = openSuccess; - result.onerror = unexpectedErrorCallback; -} - -function openSuccess() -{ - debug("createObjectStoreCallback():"); - verifySuccessEvent(event); - db = evalAndLog("db = event.result"); - - deleteAllObjectStores(db); - - result = evalAndLog("db.createObjectStore('storeName', null)"); - verifyResult(result); - result.onsuccess = createSuccess; - result.onerror = unexpectedErrorCallback; -} - -function createSuccess() -{ - verifySuccessEvent(event); - transaction = evalAndLog("db.transaction()"); - transaction.onabort = abortCallback; - var store = evalAndLog("store = transaction.objectStore('storeName')"); - shouldBeEqualToString("store.name", "storeName"); -} - -function abortCallback() -{ - verifyAbortEvent(event); - done(); -} - -test(); - -var successfullyParsed = true; diff --git a/LayoutTests/storage/indexeddb/transaction-basics.html b/LayoutTests/storage/indexeddb/transaction-basics.html index a7238f6..cea5d5d 100644 --- a/LayoutTests/storage/indexeddb/transaction-basics.html +++ b/LayoutTests/storage/indexeddb/transaction-basics.html @@ -8,6 +8,56 @@ <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/transaction-basics.js"></script> +<script> + +description("Test IndexedDB transaction basics."); +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +function test() +{ + shouldBeTrue("'indexedDB' in window"); + shouldBeFalse("indexedDB == null"); + + result = evalAndLog("indexedDB.open('name', 'description')"); + verifyResult(result); + result.onsuccess = openSuccess; + result.onerror = unexpectedErrorCallback; +} + +function openSuccess() +{ + debug("createObjectStoreCallback():"); + verifySuccessEvent(event); + db = evalAndLog("db = event.result"); + + deleteAllObjectStores(db); + + result = evalAndLog("db.createObjectStore('storeName', null)"); + verifyResult(result); + result.onsuccess = createSuccess; + result.onerror = unexpectedErrorCallback; +} + +function createSuccess() +{ + verifySuccessEvent(event); + transaction = evalAndLog("db.transaction()"); + transaction.onabort = abortCallback; + var store = evalAndLog("store = transaction.objectStore('storeName')"); + shouldBeEqualToString("store.name", "storeName"); +} + +function abortCallback() +{ + verifyAbortEvent(event); + done(); +} + +test(); + +var successfullyParsed = true; + +</script> </body> </html> |