Changeset 212147 in webkit
- Timestamp:
- Feb 10, 2017, 1:51:44 PM (9 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 added
- 6 edited
-
ChangeLog (modified) (1 diff)
-
media/track/w3c/interfaces/HTMLTrackElement/srclang-expected.txt (modified) (1 diff)
-
media/track/w3c/interfaces/TextTrack/language-expected.txt (modified) (1 diff)
-
resources/testharness.js (modified) (18 diffs)
-
streams/shadowing-Promise-expected.txt (modified) (1 diff)
-
streams/shadowing-Promise.html (modified) (1 diff)
-
streams/streams-public-array-api-expected.txt (added)
-
streams/streams-public-array-api.html (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r212141 r212147 1 2017-02-10 Chris Dumez <cdumez@apple.com> 2 3 Update LayoutTests/resources/testharness.js 4 https://bugs.webkit.org/show_bug.cgi?id=168100 5 6 Reviewed by Youenn Fablet. 7 8 Update LayoutTests/resources/testharness.js to match the web-platform-tests 9 one landed in r211930. 10 11 * media/track/w3c/interfaces/HTMLTrackElement/srclang-expected.txt: 12 * media/track/w3c/interfaces/TextTrack/language-expected.txt: 13 * resources/testharness.js: 14 (SharedWorkerTestEnvironment): 15 (ServiceWorkerTestEnvironment): 16 (create_test_environment): 17 (promise_test): 18 (EventWatcher): 19 (is_node): 20 (format_value): 21 * streams/shadowing-Promise-expected.txt: 22 * streams/shadowing-Promise.html: 23 * streams/streams-public-array-api-expected.txt: Added. 24 * streams/streams-public-array-api.html: Added. 25 1 26 2017-02-10 Ryan Haddad <ryanhaddad@apple.com> 2 27 -
trunk/LayoutTests/media/track/w3c/interfaces/HTMLTrackElement/srclang-expected.txt
r210280 r212147 2 2 CONSOLE MESSAGE: line 64: The language ' foo 3 3 ' is not a valid BCP 47 language tag. 4 CONSOLE MESSAGE: line 1 380: The language ' foo4 CONSOLE MESSAGE: line 1409: The language ' foo 5 5 ' is not a valid BCP 47 language tag. 6 CONSOLE MESSAGE: line 1 380: The language contains a null character and is not a valid BCP 47 language tag.6 CONSOLE MESSAGE: line 1409: The language contains a null character and is not a valid BCP 47 language tag. 7 7 8 8 PASS HTMLTrackElement.srclang missing value -
trunk/LayoutTests/media/track/w3c/interfaces/TextTrack/language-expected.txt
r210280 r212147 1 CONSOLE MESSAGE: line 1 380: The language contains a null character and is not a valid BCP 47 language tag.1 CONSOLE MESSAGE: line 1409: The language contains a null character and is not a valid BCP 47 language tag. 2 2 CONSOLE MESSAGE: line 26: The language contains a null character and is not a valid BCP 47 language tag. 3 3 -
trunk/LayoutTests/resources/testharness.js
r194136 r212147 390 390 function(message_event) { 391 391 this_obj._add_message_port(message_event.source); 392 } );392 }, false); 393 393 } 394 394 SharedWorkerTestEnvironment.prototype = Object.create(WorkerTestEnvironment.prototype); … … 431 431 } 432 432 } 433 } );433 }, false); 434 434 435 435 // The oninstall event is received after the service worker script and … … 472 472 return new ServiceWorkerTestEnvironment(); 473 473 } 474 if ('WorkerGlobalScope' in self && 475 self instanceof WorkerGlobalScope) { 476 return new DedicatedWorkerTestEnvironment(); 477 } 478 474 479 throw new Error("Unsupported test environment"); 475 480 } … … 519 524 var test = async_test(name, properties); 520 525 // If there is no promise tests queue make one. 521 test.step(function() { 522 if (!tests.promise_tests) { 523 tests.promise_tests = Promise.resolve(); 524 } 525 }); 526 if (!tests.promise_tests) { 527 tests.promise_tests = Promise.resolve(); 528 } 526 529 tests.promise_tests = tests.promise_tests.then(function() { 527 return Promise.resolve(test.step(func, test, test)) 528 .then( 530 var donePromise = new Promise(function(resolve) { 531 test.add_cleanup(resolve); 532 }); 533 var promise = test.step(func, test, test); 534 test.step(function() { 535 assert_not_equals(promise, undefined); 536 }); 537 Promise.resolve(promise).then( 529 538 function() { 530 539 test.done(); … … 538 547 "Unhandled rejection with value: ${value}", {value:value}); 539 548 })); 549 return donePromise; 540 550 }); 541 551 } 542 552 543 function promise_rejects(test, expected, promise ) {544 return promise.then(test.unreached_func("Should have rejected .")).catch(function(e) {545 assert_throws(expected, function() { throw e } );553 function promise_rejects(test, expected, promise, description) { 554 return promise.then(test.unreached_func("Should have rejected: " + description)).catch(function(e) { 555 assert_throws(expected, function() { throw e }, description); 546 556 }); 547 557 } … … 580 590 581 591 for (var i = 0; i < eventTypes.length; i++) { 582 watchedNode.addEventListener(eventTypes[i], eventHandler );592 watchedNode.addEventListener(eventTypes[i], eventHandler, false); 583 593 } 584 594 … … 605 615 function stop_watching() { 606 616 for (var i = 0; i < eventTypes.length; i++) { 607 watchedNode.removeEventListener(eventTypes[i], eventHandler );617 watchedNode.removeEventListener(eventTypes[i], eventHandler, false); 608 618 } 609 619 }; … … 698 708 // iframe's contentWindow): 699 709 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=12295 700 if ("nodeType" in object && 701 "nodeName" in object && 702 "nodeValue" in object && 703 "childNodes" in object) { 710 try { 711 var has_node_properties = ("nodeType" in object && 712 "nodeName" in object && 713 "nodeValue" in object && 714 "childNodes" in object); 715 } catch (e) { 716 // We're probably cross-origin, which means we aren't a node 717 return false; 718 } 719 720 if (has_node_properties) { 704 721 try { 705 722 object.nodeType; … … 714 731 } 715 732 733 var replacements = { 734 "0": "0", 735 "1": "x01", 736 "2": "x02", 737 "3": "x03", 738 "4": "x04", 739 "5": "x05", 740 "6": "x06", 741 "7": "x07", 742 "8": "b", 743 "9": "t", 744 "10": "n", 745 "11": "v", 746 "12": "f", 747 "13": "r", 748 "14": "x0e", 749 "15": "x0f", 750 "16": "x10", 751 "17": "x11", 752 "18": "x12", 753 "19": "x13", 754 "20": "x14", 755 "21": "x15", 756 "22": "x16", 757 "23": "x17", 758 "24": "x18", 759 "25": "x19", 760 "26": "x1a", 761 "27": "x1b", 762 "28": "x1c", 763 "29": "x1d", 764 "30": "x1e", 765 "31": "x1f", 766 "0xfffd": "ufffd", 767 "0xfffe": "ufffe", 768 "0xffff": "uffff", 769 }; 770 716 771 /* 717 772 * Convert a value to a nice, human-readable string … … 735 790 case "string": 736 791 val = val.replace("\\", "\\\\"); 737 for (var i = 0; i < 32; i++) { 738 var replace = "\\"; 739 switch (i) { 740 case 0: replace += "0"; break; 741 case 1: replace += "x01"; break; 742 case 2: replace += "x02"; break; 743 case 3: replace += "x03"; break; 744 case 4: replace += "x04"; break; 745 case 5: replace += "x05"; break; 746 case 6: replace += "x06"; break; 747 case 7: replace += "x07"; break; 748 case 8: replace += "b"; break; 749 case 9: replace += "t"; break; 750 case 10: replace += "n"; break; 751 case 11: replace += "v"; break; 752 case 12: replace += "f"; break; 753 case 13: replace += "r"; break; 754 case 14: replace += "x0e"; break; 755 case 15: replace += "x0f"; break; 756 case 16: replace += "x10"; break; 757 case 17: replace += "x11"; break; 758 case 18: replace += "x12"; break; 759 case 19: replace += "x13"; break; 760 case 20: replace += "x14"; break; 761 case 21: replace += "x15"; break; 762 case 22: replace += "x16"; break; 763 case 23: replace += "x17"; break; 764 case 24: replace += "x18"; break; 765 case 25: replace += "x19"; break; 766 case 26: replace += "x1a"; break; 767 case 27: replace += "x1b"; break; 768 case 28: replace += "x1c"; break; 769 case 29: replace += "x1d"; break; 770 case 30: replace += "x1e"; break; 771 case 31: replace += "x1f"; break; 772 } 773 val = val.replace(RegExp(String.fromCharCode(i), "g"), replace); 792 for (var p in replacements) { 793 var replace = "\\" + replacements[p]; 794 val = val.replace(RegExp(String.fromCharCode(p), "g"), replace); 774 795 } 775 796 return '"' + val.replace(/"/g, '\\"') + '"'; … … 819 840 /* falls through */ 820 841 default: 821 return typeof val + ' "' + truncate(String(val), 60) + '"'; 842 try { 843 return typeof val + ' "' + truncate(String(val), 1000) + '"'; 844 } catch(e) { 845 return ("[stringifying object threw " + String(e) + 846 " with type " + String(typeof e) + "]"); 847 } 822 848 } 823 849 } … … 1177 1203 NOT_FOUND_ERR: 'NotFoundError', 1178 1204 NOT_SUPPORTED_ERR: 'NotSupportedError', 1205 INUSE_ATTRIBUTE_ERR: 'InUseAttributeError', 1179 1206 INVALID_STATE_ERR: 'InvalidStateError', 1180 1207 SYNTAX_ERR: 'SyntaxError', … … 1203 1230 NotFoundError: 8, 1204 1231 NotSupportedError: 9, 1232 InUseAttributeError: 10, 1205 1233 InvalidStateError: 11, 1206 1234 SyntaxError: 12, … … 1227 1255 VersionError: 0, 1228 1256 OperationError: 0, 1257 NotAllowedError: 0 1229 1258 }; 1230 1259 … … 1437 1466 return setTimeout(this.step_func(function() { 1438 1467 return f.apply(test_this, args); 1439 } , timeout * tests.timeout_multiplier));1468 }), timeout * tests.timeout_multiplier); 1440 1469 } 1441 1470 … … 2443 2472 } 2444 2473 2474 // 'Error.stack' is not supported in all browsers/versions 2475 if (!stack) { 2476 return "(Stack trace unavailable)"; 2477 } 2478 2445 2479 var lines = stack.split("\n"); 2446 2480 2447 2481 // Create a pattern to match stack frames originating within testharness.js. These include the 2448 2482 // script URL, followed by the line/col (e.g., '/resources/testharness.js:120:21'). 2449 var re = new RegExp((get_script_url() || "\\btestharness.js") + ":\\d+:\\d+"); 2483 // Escape the URL per http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript 2484 // in case it contains RegExp characters. 2485 var script_url = get_script_url(); 2486 var re_text = script_url ? script_url.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') : "\\btestharness.js"; 2487 var re = new RegExp(re_text + ":\\d+:\\d+"); 2450 2488 2451 2489 // Some browsers include a preamble that specifies the type of the error object. Skip this by … … 2635 2673 var tests = new Tests(); 2636 2674 2637 addEventListener("error",function(e) {2675 var error_handler = function(e) { 2638 2676 if (tests.file_is_test) { 2639 2677 var test = tests.tests[0]; … … 2650 2688 tests.status.stack = e.stack; 2651 2689 } 2652 }); 2690 }; 2691 2692 addEventListener("error", error_handler, false); 2693 addEventListener("unhandledrejection", function(e){ error_handler(e.reason); }, false); 2653 2694 2654 2695 test_environment.on_tests_ready(); -
trunk/LayoutTests/streams/shadowing-Promise-expected.txt
r203772 r212147 10 10 PASS Streams should not directly use ReadableStream public APIs 11 11 PASS Streams should not directly use ReadableStreamDefaultReader read public API 12 PASS Streams should not directly use array public APIs13 12 -
trunk/LayoutTests/streams/shadowing-Promise.html
r203772 r212147 150 150 } 151 151 }, 'Streams should not directly use ReadableStreamDefaultReader read public API'); 152 153 promise_test(function() {154 const ArrayPushBackup = Array.prototype.push;155 const ArrayShiftBackup = Array.prototype.shift;156 157 // Use of testing variable to try not messing up testharness.js code.158 // FIXME: this approach is far from perfect: push is used in case an assert fails.159 // But cleanTest will not be called and we may end-up mask the real assertion failure by below assert_unreached messages.160 // We might want to either improve testharness.js or move these tests out of testharness.js.161 let testing = true;162 Array.prototype.push = function() {163 if (testing) {164 testing = false;165 assert_unreached("Array.prototype.push called");166 }167 return ArrayPushBackup.apply(this, arguments);168 }169 170 Array.prototype.shift = function() {171 if (testing) {172 testing = false;173 assert_unreached("Array.prototype.shift called");174 }175 return ArrayShiftBackup.call(this, arguments);176 }177 178 function cleanTest() {179 Array.prototype.push = ArrayPushBackup;180 Array.prototype.shift = ArrayShiftBackup;181 }182 try {183 let _controller;184 const reader = new ReadableStream({185 start: function(controller) {186 _controller = controller;187 }188 }).getReader();189 // checking whether pushing/shifting pending read promises is shielded.190 const readPromise = reader.read().then(function(result) {191 assert_equals(result.value, "half baked potato");192 // checking whether pushing/shifting enqueued values is shielded.193 _controller.enqueue("fully baked potato");194 return reader.read().then(function(result) {195 assert_equals(result.value, "fully baked potato");196 cleanTest();197 }, cleanTest);198 }, cleanTest);199 _controller.enqueue("half baked potato");200 return readPromise;201 } catch (error) {202 cleanTest();203 return Promise.reject(error);204 }205 }, 'Streams should not directly use array public APIs');206 152 </script>
Note:
See TracChangeset
for help on using the changeset viewer.