Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/idl-callback-function-unittest.html

Issue 2350813005: bindings: Support sequence in callback function arguments (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 var callbackFunctionTest = internals.callbackFunctionTest(); 5 var callbackFunctionTest = internals.callbackFunctionTest();
6 6
7 test(function() { 7 test(function() {
8 var callback1 = function(msg1, msg2) { 8 var callback1 = function(msg1, msg2) {
9 return msg1 + ', ' + msg2; 9 return msg1 + ', ' + msg2;
10 }; 10 };
(...skipping 13 matching lines...) Expand all
24 callbackFunctionTest.testInterfaceCallback(addInnerHTML, divElement); 24 callbackFunctionTest.testInterfaceCallback(addInnerHTML, divElement);
25 assert_equals(divElement.innerHTML, 'hello'); 25 assert_equals(divElement.innerHTML, 'hello');
26 }, 'Callback function which takes a interface'); 26 }, 'Callback function which takes a interface');
27 27
28 test(function() { 28 test(function() {
29 var callback = function() { 29 var callback = function() {
30 assert_equals(this, callbackFunctionTest); 30 assert_equals(this, callbackFunctionTest);
31 }; 31 };
32 callbackFunctionTest.testReceiverObjectCallback(callback); 32 callbackFunctionTest.testReceiverObjectCallback(callback);
33 }, 'Callback function which takes receiver object'); 33 }, 'Callback function which takes receiver object');
34
35 test(function() {
36 var squareStringNumbers = function(numbers) {
37 return numbers.map(n => (n * n).toString());
38 };
39 var results = callbackFunctionTest.testSequenceCallback(squareStringNumbers, [1, 2, 3]);
40 assert_equals(3, results.length);
41 assert_equals('1', results[0]);
42 assert_equals('4', results[1]);
43 assert_equals('9', results[2]);
44 }, 'Callback function which takes a number sequence');
34 </script> 45 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698