diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:23:55 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-04-27 17:07:03 +0100 |
commit | 692e5dbf12901edacf14812a6fae25462920af42 (patch) | |
tree | d62802373a429e0a9dc093b6046c166b2c514285 /LayoutTests | |
parent | e24bea4efef1c414137d36a9778aa4e142e10c7d (diff) | |
download | external_webkit-692e5dbf12901edacf14812a6fae25462920af42.zip external_webkit-692e5dbf12901edacf14812a6fae25462920af42.tar.gz external_webkit-692e5dbf12901edacf14812a6fae25462920af42.tar.bz2 |
Merge webkit.org at r55033 : Initial merge by git
Change-Id: I98a4af828067cc243ec3dc5e5826154dd88074b5
Diffstat (limited to 'LayoutTests')
14 files changed, 438 insertions, 246 deletions
diff --git a/LayoutTests/fast/events/touch/basic-touch-events-expected.txt b/LayoutTests/fast/events/touch/basic-multi-touch-events-expected.txt index 7ae4527..67db8dc 100644 --- a/LayoutTests/fast/events/touch/basic-touch-events-expected.txt +++ b/LayoutTests/fast/events/touch/basic-multi-touch-events-expected.txt @@ -1,50 +1,8 @@ -This tests basic touch event support. -single touch sequence -PASS lastEvent.type is "touchstart" -PASS lastEvent.touches.length is 1 -PASS lastEvent.changedTouches.length is 1 -PASS lastEvent.targetTouches.length is 1 -PASS lastEvent.shiftKey is false -PASS lastEvent.touches[0].target.id is "touchtarget" -PASS lastEvent.touches[0].pageX is 10 -PASS lastEvent.touches[0].pageY is 10 -PASS lastEvent.touches[0].clientX is 10 -PASS lastEvent.touches[0].clientY is 10 -PASS lastEvent.touches[0].identifier is 0 -PASS lastEvent.changedTouches[0].pageX is 10 -PASS lastEvent.changedTouches[0].pageY is 10 -PASS lastEvent.changedTouches[0].clientX is 10 -PASS lastEvent.changedTouches[0].clientY is 10 -PASS lastEvent.changedTouches[0].identifier is 0 -PASS lastEvent.targetTouches[0].pageX is 10 -PASS lastEvent.targetTouches[0].pageY is 10 -PASS lastEvent.targetTouches[0].clientX is 10 -PASS lastEvent.targetTouches[0].clientY is 10 -PASS lastEvent.targetTouches[0].identifier is 0 -PASS lastEvent.type is "touchmove" -PASS lastEvent.touches.length is 1 -PASS lastEvent.changedTouches.length is 1 -PASS lastEvent.targetTouches.length is 1 -PASS lastEvent.touches[0].pageX is 20 -PASS lastEvent.touches[0].pageY is 15 -PASS lastEvent.touches[0].clientX is 20 -PASS lastEvent.touches[0].clientY is 15 -PASS lastEvent.touches[0].identifier is 0 -PASS lastEvent.shiftKey is true -PASS lastEvent.altKey is true -PASS lastEvent.ctrlKey is false -PASS lastEvent.metaKey is false -PASS lastEvent.type is "touchend" -PASS lastEvent.touches.length is 0 -PASS lastEvent.changedTouches.length is 1 -PASS lastEvent.targetTouches.length is 0 -PASS lastEvent.changedTouches[0].pageX is 20 -PASS lastEvent.changedTouches[0].pageY is 15 -PASS lastEvent.changedTouches[0].clientX is 20 -PASS lastEvent.changedTouches[0].clientY is 15 -PASS lastEvent.changedTouches[0].identifier is 0 -PASS lastEvent.shiftKey is false -PASS lastEvent.altKey is false +This tests basic multi touch event support. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + multi touch sequence Two touchpoints pressed PASS lastEvent.type is "touchstart" @@ -131,17 +89,6 @@ PASS lastEvent.changedTouches[0].pageY is 30 PASS lastEvent.changedTouches[0].clientX is 20 PASS lastEvent.changedTouches[0].clientY is 30 PASS lastEvent.changedTouches[0].identifier is 1 -verify touch targets -PASS lastEvent.type is "touchstart" -PASS lastEvent.touches.length is 1 -PASS lastEvent.changedTouches.length is 1 -PASS lastEvent.targetTouches.length is 1 -PASS lastEvent.targetTouches[0].target.tagName is "DIV" -PASS lastEvent.type is "touchmove" -PASS lastEvent.touches.length is 1 -PASS lastEvent.changedTouches.length is 1 -PASS lastEvent.targetTouches.length is 0 -PASS lastEvent.touches[0].target.tagName is "HTML" PASS successfullyParsed is true TEST COMPLETE diff --git a/LayoutTests/fast/events/touch/basic-touch-events.html b/LayoutTests/fast/events/touch/basic-multi-touch-events.html index c50c6fc..951e169 100644 --- a/LayoutTests/fast/events/touch/basic-touch-events.html +++ b/LayoutTests/fast/events/touch/basic-multi-touch-events.html @@ -3,11 +3,12 @@ <head> <link rel="stylesheet" href="../../js/resources/js-test-style.css"> <script src="../../js/resources/js-test-pre.js"></script> +<script src="../../js/resources/js-test-post-function.js"></script> </head> <body> <p id="description"></p> <div id="console"></div> -<script src="script-tests/basic-touch-events.js"></script> -<script src="../../js/resources/js-test-post.js"></script> +<script src="script-tests/basic-multi-touch-events.js"></script> + </body> </html> diff --git a/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt b/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt new file mode 100644 index 0000000..634faa1 --- /dev/null +++ b/LayoutTests/fast/events/touch/basic-single-touch-events-expected.txt @@ -0,0 +1,64 @@ +This tests basic single touch event support. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS lastEvent.type is "touchstart" +PASS lastEvent.touches.length is 1 +PASS lastEvent.changedTouches.length is 1 +PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.shiftKey is false +PASS lastEvent.touches[0].target.id is "touchtarget" +PASS lastEvent.touches[0].pageX is 10 +PASS lastEvent.touches[0].pageY is 10 +PASS lastEvent.touches[0].clientX is 10 +PASS lastEvent.touches[0].clientY is 10 +PASS lastEvent.touches[0].identifier is 0 +PASS lastEvent.changedTouches[0].pageX is 10 +PASS lastEvent.changedTouches[0].pageY is 10 +PASS lastEvent.changedTouches[0].clientX is 10 +PASS lastEvent.changedTouches[0].clientY is 10 +PASS lastEvent.changedTouches[0].identifier is 0 +PASS lastEvent.targetTouches[0].pageX is 10 +PASS lastEvent.targetTouches[0].pageY is 10 +PASS lastEvent.targetTouches[0].clientX is 10 +PASS lastEvent.targetTouches[0].clientY is 10 +PASS lastEvent.targetTouches[0].identifier is 0 +PASS lastEvent.type is "touchmove" +PASS lastEvent.touches.length is 1 +PASS lastEvent.changedTouches.length is 1 +PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.touches[0].pageX is 20 +PASS lastEvent.touches[0].pageY is 15 +PASS lastEvent.touches[0].clientX is 20 +PASS lastEvent.touches[0].clientY is 15 +PASS lastEvent.touches[0].identifier is 0 +PASS lastEvent.shiftKey is true +PASS lastEvent.altKey is true +PASS lastEvent.ctrlKey is false +PASS lastEvent.metaKey is false +PASS lastEvent.type is "touchend" +PASS lastEvent.touches.length is 0 +PASS lastEvent.changedTouches.length is 1 +PASS lastEvent.targetTouches.length is 0 +PASS lastEvent.changedTouches[0].pageX is 20 +PASS lastEvent.changedTouches[0].pageY is 15 +PASS lastEvent.changedTouches[0].clientX is 20 +PASS lastEvent.changedTouches[0].clientY is 15 +PASS lastEvent.changedTouches[0].identifier is 0 +PASS lastEvent.shiftKey is false +PASS lastEvent.altKey is false +PASS lastEvent.type is "touchstart" +PASS lastEvent.touches.length is 1 +PASS lastEvent.changedTouches.length is 1 +PASS lastEvent.targetTouches.length is 1 +PASS lastEvent.targetTouches[0].target.tagName is "DIV" +PASS lastEvent.type is "touchmove" +PASS lastEvent.touches.length is 1 +PASS lastEvent.changedTouches.length is 1 +PASS lastEvent.targetTouches.length is 0 +PASS lastEvent.touches[0].target.tagName is "HTML" +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/events/touch/basic-single-touch-events.html b/LayoutTests/fast/events/touch/basic-single-touch-events.html new file mode 100644 index 0000000..4f870f4 --- /dev/null +++ b/LayoutTests/fast/events/touch/basic-single-touch-events.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +<script src="../../js/resources/js-test-post-function.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/basic-single-touch-events.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js b/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js new file mode 100644 index 0000000..abfaf90 --- /dev/null +++ b/LayoutTests/fast/events/touch/script-tests/basic-multi-touch-events.js @@ -0,0 +1,115 @@ +var div = document.createElement("div"); +div.id = "touchtarget"; +div.style.width = "100px"; +div.style.height = "100px"; +div.style.backgroundColor = "blue"; + +var lastEvent = null; +var touchEventsReceived = 0; +var EXPECTED_TOUCH_EVENTS_TOTAL = 4; + +function touchEventCallback() { + if (window.eventSender) { + lastEvent = event; + verifyTouch(touchEventsReceived++); + } else { + debug(event.type); + } + + if (window.layoutTestController && touchEventsReceived == EXPECTED_TOUCH_EVENTS_TOTAL) { + // If we've got here, we can safely say we were successfully parsed :) We need to + // call the isSucccessfullyParsed function to output the correct TEST COMPLETE + // footer message. + successfullyParsed = true; + isSuccessfullyParsed(); + layoutTestController.notifyDone(); + } +} + +div.addEventListener("touchstart", touchEventCallback, false); +div.addEventListener("touchmove", touchEventCallback, false); +div.addEventListener("touchend", touchEventCallback, false); +document.body.insertBefore(div, document.body.firstChild); + +function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchCount) +{ + shouldBeEqualToString("lastEvent.type", type); + shouldBe("lastEvent.touches.length", totalTouchCount.toString()); + shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); + shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); +} + +function verifyTouchPoint(list, point, x, y, id) +{ + shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString()); + shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString()); + shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString()); + shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString()); + shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString()); +} + +function verifyTouch(which) { + switch (which) { + case 0: + verifyTouchEvent("touchstart", 2, 2, 2); + verifyTouchPoint("touches", 0, 10, 10, 0); + verifyTouchPoint("touches", 1, 20, 30, 1); + verifyTouchPoint("changedTouches", 0, 10, 10, 0); + verifyTouchPoint("changedTouches", 1, 20, 30, 1); + verifyTouchPoint("targetTouches", 0, 10, 10, 0); + verifyTouchPoint("targetTouches", 1, 20, 30, 1); + break; + case 1: + verifyTouchEvent("touchmove", 2, 1, 2); + verifyTouchPoint("touches", 0, 15, 15, 0); + verifyTouchPoint("changedTouches", 0, 15, 15, 0); + verifyTouchPoint("touches", 1, 20, 30, 1); + break; + case 2: + verifyTouchEvent("touchend", 1, 1, 1); + verifyTouchPoint("touches", 0, 20, 30, 1); + verifyTouchPoint("changedTouches", 0, 15, 15, 0); + verifyTouchPoint("targetTouches", 0, 20, 30, 1); + break; + case 3: + verifyTouchEvent("touchend", 0, 1, 0); + verifyTouchPoint("changedTouches", 0, 20, 30, 1); + break; + + default: testFailed("Wrong number of touch events! (" + which + ")"); + } +} + +function multiTouchSequence() +{ + debug("multi touch sequence"); + + debug("Two touchpoints pressed"); + eventSender.addTouchPoint(10, 10); + eventSender.addTouchPoint(20, 30); + eventSender.touchStart(); + + debug("First touchpoint moved"); + eventSender.updateTouchPoint(0, 15, 15); + eventSender.touchMove(); + + debug("First touchpoint is released"); + eventSender.releaseTouchPoint(0); + eventSender.touchEnd(); + + debug("Last remaining touchpoint is released"); + eventSender.releaseTouchPoint(0); + eventSender.touchEnd(); +} + +if (window.eventSender) { + description("This tests basic multi touch event support."); + + lastEvent = null; + eventSender.clearTouchPoints(); + multiTouchSequence(); +} else { + debug("This test requires DumpRenderTree. Tap on the blue rect to log.") +} + +var successfullyParsed = true; diff --git a/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js b/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js new file mode 100644 index 0000000..ca99d83 --- /dev/null +++ b/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js @@ -0,0 +1,132 @@ +var div = document.createElement("div"); +div.id = "touchtarget"; +div.style.width = "100px"; +div.style.height = "100px"; +div.style.backgroundColor = "blue"; + +var lastEvent = null; +var touchEventsReceived = 0; +var EXPECTED_TOUCH_EVENTS_TOTAL = 5; + +function touchEventCallback() { + if (window.eventSender) { + lastEvent = event; + verifyTouch(touchEventsReceived++); + } else { + debug(event.type); + } + + if (window.layoutTestController && touchEventsReceived == EXPECTED_TOUCH_EVENTS_TOTAL) { + // If we've got here, we can safely say we were successfully parsed :) We need to + // call the isSucccessfullyParsed function to output the correct TEST COMPLETE + // footer message. + successfullyParsed = true; + isSuccessfullyParsed(); + layoutTestController.notifyDone(); + } +} + +div.addEventListener("touchstart", touchEventCallback, false); +div.addEventListener("touchmove", touchEventCallback, false); +div.addEventListener("touchend", touchEventCallback, false); +document.body.insertBefore(div, document.body.firstChild); + +function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchCount) +{ + shouldBeEqualToString("lastEvent.type", type); + shouldBe("lastEvent.touches.length", totalTouchCount.toString()); + shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); + shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); +} + +function verifyTouchPoint(list, point, x, y, id) +{ + shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString()); + shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString()); + shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString()); + shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString()); + shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString()); +} + +function verifyTouch(which) { + switch (which) { + case 0: + verifyTouchEvent("touchstart", 1, 1, 1); + shouldBe("lastEvent.shiftKey", "false"); + shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget"); + verifyTouchPoint("touches", 0, 10, 10, 0); + verifyTouchPoint("changedTouches", 0, 10, 10, 0); + verifyTouchPoint("targetTouches", 0, 10, 10, 0); + break; + case 1: + verifyTouchEvent("touchmove", 1, 1, 1); + verifyTouchPoint("touches", 0, 20, 15, 0); + shouldBe("lastEvent.shiftKey", "true"); + shouldBe("lastEvent.altKey", "true"); + shouldBe("lastEvent.ctrlKey", "false"); + shouldBe("lastEvent.metaKey", "false"); + break; + case 2: + verifyTouchEvent("touchend", 0, 1, 0); + verifyTouchPoint("changedTouches", 0, 20, 15, 0); + shouldBe("lastEvent.shiftKey", "false"); + shouldBe("lastEvent.altKey", "false"); + break; + case 3: + verifyTouchEvent("touchstart", 1, 1, 1); + shouldBeEqualToString("lastEvent.targetTouches[0].target.tagName", "DIV"); + break; + case 4: + verifyTouchEvent("touchmove", 1, 1, 0); + shouldBeEqualToString("lastEvent.touches[0].target.tagName", "HTML"); + break; + + default: testFailed("Wrong number of touch events! (" + which + ")"); + } +} + +function singleTouchSequence() +{ + eventSender.addTouchPoint(10, 10); + eventSender.touchStart(); + + eventSender.updateTouchPoint(0, 20, 15); + eventSender.setTouchModifier("shift", true); + eventSender.setTouchModifier("alt", true); + eventSender.touchMove(); + + eventSender.setTouchModifier("shift", false); + eventSender.setTouchModifier("alt", false); + + eventSender.releaseTouchPoint(0); + eventSender.touchEnd(); +} + +function touchTargets() +{ + eventSender.addTouchPoint(10, 10); + eventSender.touchStart(); + + eventSender.updateTouchPoint(0, 1000, 1000); + eventSender.touchMove(); +} + +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +if (window.eventSender) { + description("This tests basic single touch event support."); + + lastEvent = null; + eventSender.clearTouchPoints(); + singleTouchSequence(); + + lastEvent = null; + eventSender.clearTouchPoints(); + touchTargets(); + +} else { + debug("This test requires DumpRenderTree. Tap on the blue rect to log.") +} + + diff --git a/LayoutTests/fast/events/touch/script-tests/basic-touch-events.js b/LayoutTests/fast/events/touch/script-tests/basic-touch-events.js deleted file mode 100644 index 6766abc..0000000 --- a/LayoutTests/fast/events/touch/script-tests/basic-touch-events.js +++ /dev/null @@ -1,154 +0,0 @@ -description = "This tests basic touch event support."; - -var div = document.createElement("div"); -div.id = "touchtarget"; -div.style.width = "100px"; -div.style.height = "100px"; -div.style.backgroundColor = "blue"; - -var lastEvent = null; - -function appendEventLog() { - if (window.eventSender) { - lastEvent = event; - } else { - debug(event.type); - } -} - -div.addEventListener("touchstart", appendEventLog, false); -div.addEventListener("touchmove", appendEventLog, false); -div.addEventListener("touchend", appendEventLog, false); -document.body.insertBefore(div, document.body.firstChild); - -function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchCount) -{ - shouldBeEqualToString("lastEvent.type", type); - shouldBe("lastEvent.touches.length", totalTouchCount.toString()); - shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); - shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); -} - -function verifyTouchPoint(list, point, x, y, id) -{ - shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString()); - shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString()); - shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString()); - shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString()); - shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString()); -} - -function singleTouchSequence() -{ - debug("single touch sequence"); - - eventSender.addTouchPoint(10, 10); - eventSender.touchStart(); - - verifyTouchEvent("touchstart", 1, 1, 1); - shouldBe("lastEvent.shiftKey", "false"); - shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget"); - verifyTouchPoint("touches", 0, 10, 10, 0); - verifyTouchPoint("changedTouches", 0, 10, 10, 0); - verifyTouchPoint("targetTouches", 0, 10, 10, 0); - - eventSender.updateTouchPoint(0, 20, 15); - eventSender.setTouchModifier("shift", true); - eventSender.setTouchModifier("alt", true); - eventSender.touchMove(); - - verifyTouchEvent("touchmove", 1, 1, 1); - verifyTouchPoint("touches", 0, 20, 15, 0); - shouldBe("lastEvent.shiftKey", "true"); - shouldBe("lastEvent.altKey", "true"); - shouldBe("lastEvent.ctrlKey", "false"); - shouldBe("lastEvent.metaKey", "false"); - - eventSender.setTouchModifier("shift", false); - eventSender.setTouchModifier("alt", false); - - eventSender.releaseTouchPoint(0); - eventSender.touchEnd(); - - verifyTouchEvent("touchend", 0, 1, 0); - verifyTouchPoint("changedTouches", 0, 20, 15, 0); - shouldBe("lastEvent.shiftKey", "false"); - shouldBe("lastEvent.altKey", "false"); -} - -function multiTouchSequence() -{ - debug("multi touch sequence"); - - debug("Two touchpoints pressed"); - eventSender.addTouchPoint(10, 10); - eventSender.addTouchPoint(20, 30); - eventSender.touchStart(); - verifyTouchEvent("touchstart", 2, 2, 2); - verifyTouchPoint("touches", 0, 10, 10, 0); - verifyTouchPoint("touches", 1, 20, 30, 1); - verifyTouchPoint("changedTouches", 0, 10, 10, 0); - verifyTouchPoint("changedTouches", 1, 20, 30, 1); - verifyTouchPoint("targetTouches", 0, 10, 10, 0); - verifyTouchPoint("targetTouches", 1, 20, 30, 1); - - debug("First touchpoint moved"); - eventSender.updateTouchPoint(0, 15, 15); - eventSender.touchMove(); - verifyTouchEvent("touchmove", 2, 1, 2); - verifyTouchPoint("touches", 0, 15, 15, 0); - verifyTouchPoint("changedTouches", 0, 15, 15, 0); - verifyTouchPoint("touches", 1, 20, 30, 1); - - debug("First touchpoint is released"); - eventSender.releaseTouchPoint(0); - eventSender.touchEnd(); - verifyTouchEvent("touchend", 1, 1, 1); - verifyTouchPoint("touches", 0, 20, 30, 1); - verifyTouchPoint("changedTouches", 0, 15, 15, 0); - verifyTouchPoint("targetTouches", 0, 20, 30, 1); - - debug("Last remaining touchpoint is released"); - eventSender.releaseTouchPoint(0); - eventSender.touchEnd(); - verifyTouchEvent("touchend", 0, 1, 0); - verifyTouchPoint("changedTouches", 0, 20, 30, 1); -} - -function touchTargets() -{ - debug("verify touch targets"); - - eventSender.addTouchPoint(10, 10); - eventSender.touchStart(); - - verifyTouchEvent("touchstart", 1, 1, 1); - shouldBeEqualToString("lastEvent.targetTouches[0].target.tagName", "DIV"); - - eventSender.updateTouchPoint(0, 1000, 1000); - eventSender.touchMove(); - - verifyTouchEvent("touchmove", 1, 1, 0); - shouldBeEqualToString("lastEvent.touches[0].target.tagName", "HTML"); -} - -if (window.eventSender) { - debug(description); - - lastEvent = null; - eventSender.clearTouchPoints(); - singleTouchSequence(); - - lastEvent = null; - eventSender.clearTouchPoints(); - multiTouchSequence(); - - lastEvent = null; - eventSender.clearTouchPoints(); - touchTargets(); - -} else { - debug("This test requires DumpRenderTree. Tap on the blue rect to log.") -} - -var successfullyParsed = true; diff --git a/LayoutTests/storage/database-lock-after-reload.html b/LayoutTests/storage/database-lock-after-reload.html index ad34d5b..8bdaddc 100644 --- a/LayoutTests/storage/database-lock-after-reload.html +++ b/LayoutTests/storage/database-lock-after-reload.html @@ -28,7 +28,7 @@ function addData(db) // Insert a large amount of data that will take a little while to run. Schedule a timout to run that will load a new page // whilst the transaction is still in progress, interrupting the transaction. This should not leave the database locked and on // the next page we should be able to insert some more data. - tx.executeSql("INSERT INTO DataTest (testData) VALUES (randomBlob(524200 ))", [], function(tx, result) { }, errorFunction); + tx.executeSql("INSERT INTO DataTest (testData) VALUES (ZEROBLOB(524200))", [], function(tx, result) { }, errorFunction); location.href = "./resources/database-lock-after-reload-2.html"; }, errorFunction, function() { finishTest(); diff --git a/LayoutTests/storage/null-callbacks-expected.txt b/LayoutTests/storage/null-callbacks-expected.txt new file mode 100644 index 0000000..8311675 --- /dev/null +++ b/LayoutTests/storage/null-callbacks-expected.txt @@ -0,0 +1,2 @@ +This test checks that 'null' can be used wherever we expect an optional callback. +PASS diff --git a/LayoutTests/storage/null-callbacks.html b/LayoutTests/storage/null-callbacks.html new file mode 100644 index 0000000..4ca0e1c --- /dev/null +++ b/LayoutTests/storage/null-callbacks.html @@ -0,0 +1,46 @@ +<html> +<head> +<script> +function finishTest() +{ + if (window.layoutTestController) + layoutTestController.notifyDone(); +} + +function runTest() +{ + if (window.layoutTestController) { + layoutTestController.clearAllDatabases(); + layoutTestController.dumpAsText(); + layoutTestController.waitUntilDone(); + } + + try { + var db = openDatabase("NullCallbacks", "1.0", "Test for null callbacks.", 1); + db.transaction(function(tx) { + tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)", null); + tx.executeSql("INSERT INTO Test VALUES (?)", [1], null, null); + tx.executeSql("INSERT INTO Test VALUES (?)", [2], null); + tx.executeSql("INSERT INTO Test VALUES (3)", null, null, null); + tx.executeSql("INSERT INTO Test VALUES (?)", [4], null, + function(tx, error) {}); + }, null, null); + + db.transaction(function(tx) { + tx.executeSql("INSERT INTO Test VALUES (?)", [5]); + }, null, function() { finishTest(); }); + } catch(err) { + document.getElementById("console").innerHTML = "FAIL"; + finishTest(); + } +} + +</script> +</head> + +<body onload="runTest()"> +This test checks that 'null' can be used wherever we expect an optional callback. +<pre id="console">PASS</pre> +</body> + +</html> diff --git a/LayoutTests/storage/private-browsing-readonly.html b/LayoutTests/storage/private-browsing-readonly.html index 70a209a..972b123 100644 --- a/LayoutTests/storage/private-browsing-readonly.html +++ b/LayoutTests/storage/private-browsing-readonly.html @@ -46,6 +46,7 @@ function privateBrowsingErrorFunction(tx, error) { ++completed; writeMessageToLog("Private browsing statement " + completed + " completed with an error\n" + error.message); + return false; } function runSetup(transaction) diff --git a/LayoutTests/storage/quota-tracking.html b/LayoutTests/storage/quota-tracking.html index fb2cc9e..2b5b49d 100644 --- a/LayoutTests/storage/quota-tracking.html +++ b/LayoutTests/storage/quota-tracking.html @@ -1,9 +1,9 @@ <html> <head> <script> -var database1; -var database2; -var database3; +var database1 = null; +var database2 = null; +var database3 = null; function log(message) { @@ -39,13 +39,15 @@ function checkCompletion(db) { log("Done adding data"); - db.complete = true; - if (database1.complete && database2.complete && database3.complete) + if (database3) { finishTest(); - else if (database2.complete) + } else if (database2) { + database3 = openDatabase("QuotaManagementDatabase3", "1.0", "Test for quota management <rdar://5628468>", 1); testDatabase(database3); - else + } else { + database2 = openDatabase("QuotaManagementDatabase2", "1.0", "Test for quota management <rdar://5628468>", 1); testDatabase(database2); + } } function addData(db) @@ -95,12 +97,6 @@ function runTest() } database1 = openDatabase("QuotaManagementDatabase1", "1.0", "Test for quota management <rdar://5628468>", 1); - database2 = openDatabase("QuotaManagementDatabase2", "1.0", "Test for quota management <rdar://5628468>", 1); - database3 = openDatabase("QuotaManagementDatabase3", "1.0", "Test for quota management <rdar://5628468>", 1); - database1.complete = false; - database2.complete = false; - database3.complete = false; - testDatabase(database1); } diff --git a/LayoutTests/storage/statement-error-callback-expected.txt b/LayoutTests/storage/statement-error-callback-expected.txt index ca117a8..791dfb6 100644 --- a/LayoutTests/storage/statement-error-callback-expected.txt +++ b/LayoutTests/storage/statement-error-callback-expected.txt @@ -1,5 +1,10 @@ -CONSOLE MESSAGE: line 0: Exception in Statement error callback -This test confirms that if the statement error callback returns true or throws an exception we do not execute any further statements in that transaction and instead execute the transaction error callback immediately. +CONSOLE MESSAGE: line 0: Exception in statement error callback +This test confirms that a transaction is immediately rolled back if and only if a statement's error callback throws an exception, returns true, or doesn't return any value. +PASS - the transaction error callback was invoked. +PASS - the transaction error callback was invoked. +PASS - the transaction error callback was invoked. +PASS - the transaction error callback was invoked. +PASS - the transaction error callback was invoked. PASS - the transaction error callback was invoked. PASS - the transaction error callback was invoked. Test Complete diff --git a/LayoutTests/storage/statement-error-callback.html b/LayoutTests/storage/statement-error-callback.html index 3675548..060a881 100644 --- a/LayoutTests/storage/statement-error-callback.html +++ b/LayoutTests/storage/statement-error-callback.html @@ -15,7 +15,8 @@ function finishTest() } var txCallbackCount = 0; -var NUMBER_OF_TRANSACTIONS = 2; +var NUMBER_OF_TRANSACTIONS = 7; +var database; function transactionErrorFunction(error) { @@ -31,6 +32,22 @@ function transactionSuccessFunction(message) finishTest(); } +function runTransactionExpectedToFail(statementErrorCallback) +{ + database.transaction(function(tx) { + tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)"); + tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']); + tx.executeSql("THIS STATEMENT WILL FAIL", [], + function(tx, data) { + log("FAIL - this statement should have failed"); + finishTest(); + }, statementErrorCallback); + tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], + function(error) { log("FAIL - This statement should not have been executed"); }, + function() { log("FAIL - This statement should not have been executed"); }); + }, transactionErrorFunction, transactionSuccessFunction); +} + function runTest() { if (window.layoutTestController) { @@ -38,29 +55,36 @@ function runTest() layoutTestController.dumpAsText(); layoutTestController.waitUntilDone(); } - - var database = openDatabase("bug-28872", "1.0", "statement error callback test", 1024); - - database.transaction(function(tx) { - tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)"); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']); - tx.executeSql("THIS STATEMENT WILL FAIL", [], function(message) { log("FAIL - this statement should have failed"); finishTest(); }, function(error) { return true; }); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], function(message) { log("FAIL - This statement should not have been executed"); }, function(message) { log("FAIL - This statement should not have been executed"); }); - }, transactionErrorFunction, transactionSuccessFunction); - database.transaction(function(tx) { + database = openDatabase("bug-28872", "1.0", "statement error callback test", 1024); + database.transaction(function(tx) { tx.executeSql("CREATE TABLE IF NOT EXISTS StatementErrorCallbackTest (randomData)"); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']); - tx.executeSql("THIS STATEMENT WILL FAIL", [], function(message) { log("FAIL - this statement should have failed"); finishTest(); }, function(error) { throw "Exception in Statement error callback"; return false; }); - tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], function(message) { log("FAIL - This statement should not have been executed"); }, function(message) { log("FAIL - This statement should not have been executed"); }); - }, transactionErrorFunction, transactionSuccessFunction); + tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test']); + tx.executeSql("THIS STATEMENT WILL FAIL", [], + function(tx, data) { + log("FAIL - this statement should have failed"); + finishTest(); + }, function(tx, error) { return false; }); + tx.executeSql("INSERT INTO StatementErrorCallbackTest (randomData) VALUES (?)", ['test1'], + function(tx, data) { }, + function(tx, error) { log("FAIL - This statement should not have caused an error"); }); + }, function(error) { log("FAIL - The transaction error callback should not have been invoked"); }, + function() { }); + + runTransactionExpectedToFail(function(error) { return true; }); + runTransactionExpectedToFail(function(error) { throw "Exception in statement error callback"; return false; }); + runTransactionExpectedToFail(function(error) {}); + runTransactionExpectedToFail(function(error) { return null; }); + runTransactionExpectedToFail(function(error) { return "some string"; }); + runTransactionExpectedToFail(function(error) { return 1234; }); + runTransactionExpectedToFail(function(error) { return {a: 2, b: "abc"}; }); } </script> </head> <body onload="runTest()"> -This test confirms that if the statement error callback returns true or throws an exception we do not execute any further statements in that transaction and instead execute the transaction error callback immediately. +This test confirms that a transaction is immediately rolled back if and only if a statement's error callback throws an exception, returns true, or doesn't return any value. <pre id="console"> </pre> </body> |