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

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

Issue 2350813005: bindings: Support sequence in callback function arguments (Closed)
Patch Set: Pass ExceptionState Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/idl-callback-function-unittest.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/idl-callback-function-unittest.html b/third_party/WebKit/LayoutTests/fast/dom/idl-callback-function-unittest.html
index f8ff7e029adb70b8f7eb085f008685e54ccfdf7b..2d31ad6c9e579c1c4d3efcec382b2dee8330952c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/idl-callback-function-unittest.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/idl-callback-function-unittest.html
@@ -2,8 +2,9 @@
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script>
+var callbackFunctionTest = internals.callbackFunctionTest();
+
test(function() {
- var callbackFunctionTest = internals.callbackFunctionTest();
var callback1 = function(msg1, msg2) {
return msg1 + ', ' + msg2;
};
@@ -14,4 +15,23 @@ test(function() {
};
assert_equals(callbackFunctionTest.testCallback(callback2, 'hello', 'world'), 'SUCCESS: hellohello worldworld');
}, 'Callback function which takes two strings');
+
+test(function() {
+ var squareStringNumbers = function(numbers) {
+ return numbers.map(n => (n * n).toString());
+ };
+ var results = callbackFunctionTest.testSequenceCallback(squareStringNumbers, [1, 2, 3]);
+ assert_equals(3, results.length);
+ assert_equals('1', results[0]);
+ assert_equals('4', results[1]);
+ assert_equals('9', results[2]);
+
+ var exception = new TypeError();
+ assert_throws(exception, function() {
+ var throwException = function() {
+ throw exception;
+ };
+ callbackFunctionTest.testSequenceCallback(throwException, [1, 2, 3]);
+ });
+}, 'Callback function which takes a number sequence');
</script>

Powered by Google App Engine
This is Rietveld 408576698