Modified: trunk/LayoutTests/ChangeLog (101604 => 101605)
--- trunk/LayoutTests/ChangeLog 2011-12-01 05:38:15 UTC (rev 101604)
+++ trunk/LayoutTests/ChangeLog 2011-12-01 05:42:29 UTC (rev 101605)
@@ -1,3 +1,13 @@
+2011-11-30 Rafael Weinstein <[email protected]>
+
+ [MutationObservers] Need layout tests asserting that non-event async callbacks deliver mutations after completion
+ https://bugs.webkit.org/show_bug.cgi?id=73480
+
+ Reviewed by Ryosuke Niwa.
+
+ * fast/mutation/non-event-delivery-expected.txt: Added.
+ * fast/mutation/non-event-delivery.html: Added.
+
2011-11-30 Hayato Ito <[email protected]>
Unreviewed. Update chromium test expectations for flaky inspector tests.
Added: trunk/LayoutTests/fast/mutation/non-event-delivery-expected.txt (0 => 101605)
--- trunk/LayoutTests/fast/mutation/non-event-delivery-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/mutation/non-event-delivery-expected.txt 2011-12-01 05:42:29 UTC (rev 101605)
@@ -0,0 +1,22 @@
+Test that Mutation Records are delivered following non-event async callbacks.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Testing mutations are delivered following Database transaction callbacks.
+PASS mutations.length is 1
+PASS mutations[0].type is "attributes"
+PASS mutations[0].attributeName is "foo"
+
+Testing mutations are delivered following Filesystem callbacks.
+PASS mutations.length is 1
+PASS mutations[0].type is "attributes"
+PASS mutations[0].attributeName is "foo"
+PASS mutations.length is 1
+PASS mutations[0].type is "attributes"
+PASS mutations[0].attributeName is "baz"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/mutation/non-event-delivery.html (0 => 101605)
--- trunk/LayoutTests/fast/mutation/non-event-delivery.html (rev 0)
+++ trunk/LayoutTests/fast/mutation/non-event-delivery.html 2011-12-01 05:42:29 UTC (rev 101605)
@@ -0,0 +1,127 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src=""
+</head>
+<body>
+<p id=description></p>
+<div id="console"></div>
+<script>
+
+window.jsTestIsAsync = true;
+var mutations;
+
+function testDatabase() {
+ var div;
+ var db;
+ var observer;
+
+ function start() {
+ debug('Testing mutations are delivered following Database transaction callbacks.');
+
+ mutations = null;
+ div = document.createElement('div');
+ observer = new WebKitMutationObserver(function(m) {
+ mutations = m;
+ });
+
+ observer.observe(div, { attributes: true, characterData: true });
+
+ db = openDatabase('DatabaseMutationDelivery', '1.0', '', 1);
+ db.transaction(mutate);
+ }
+
+ function mutate() {
+ div.setAttribute('foo', 'bar');
+ setTimeout(finish, 0);
+ }
+
+ function finish() {
+ shouldBe('mutations.length', '1');
+ shouldBe('mutations[0].type', '"attributes"');
+ shouldBe('mutations[0].attributeName', '"foo"');
+ observer.disconnect();
+ debug('');
+ runNextTest();
+ }
+
+ start();
+}
+
+function testFilesystem() {
+ var div;
+ var fileEntry;
+ var observer;
+
+ function start() {
+ debug('Testing mutations are delivered following Filesystem callbacks.');
+
+ mutations = null;
+ div = document.createElement('div');
+ observer = new WebKitMutationObserver(function(m) {
+ mutations = m;
+ });
+
+ observer.observe(div, { attributes: true, characterData: true });
+
+ webkitRequestFileSystem(TEMPORARY, 5*1024*1024, function(fs) {
+ fs.root.getFile('foo.txt', {create: true, excluse: true}, function(entry) {
+ fileEntry = entry;
+ fileEntry.getParent(mutateAfterGetParent);
+ });
+ });
+ }
+
+ function mutateAfterGetParent() {
+ div.setAttribute('foo', 'bar');
+ fileEntry.remove(mutateAfterRemove);
+ }
+
+ function mutateAfterRemove() {
+ shouldBe('mutations.length', '1');
+ shouldBe('mutations[0].type', '"attributes"');
+ shouldBe('mutations[0].attributeName', '"foo"');
+
+ mutations = null;
+ div.setAttribute('baz', 'bat');
+ setTimeout(finish, 0);
+ }
+
+ function finish() {
+ shouldBe('mutations.length', '1');
+ shouldBe('mutations[0].type', '"attributes"');
+ shouldBe('mutations[0].attributeName', '"baz"');
+
+ observer.disconnect();
+ debug('');
+ runNextTest();
+ }
+
+ start();
+}
+
+var tests = [
+ testDatabase,
+ testFilesystem
+];
+var testIndex = 0;
+
+function runNextTest() {
+ if (testIndex < tests.length)
+ tests[testIndex++]();
+ else
+ finishJSTest();
+}
+
+description('Test that Mutation Records are delivered following non-event async callbacks.');
+
+if (!window.WebKitMutationObserver)
+ testFailed('This test requires ENABLE(MUTATION_OBSERVERS)');
+else
+ runNextTest();
+
+</script>
+<script src=""
+</body>
+</html>