OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/testing/CallbackFunctionTest.h" | 5 #include "core/testing/CallbackFunctionTest.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
8 #include "bindings/core/v8/V8Binding.h" | 8 #include "bindings/core/v8/V8Binding.h" |
9 #include "bindings/core/v8/V8TestCallback.h" | 9 #include "bindings/core/v8/V8TestCallback.h" |
| 10 #include "bindings/core/v8/V8TestSequenceCallback.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 DEFINE_TRACE(CallbackFunctionTest) | 14 DEFINE_TRACE(CallbackFunctionTest) |
14 { | 15 { |
15 } | 16 } |
16 | 17 |
17 String CallbackFunctionTest::testCallback(ScriptState* scriptState, V8TestCallba
ck* callback, const String& message1, const String& message2, ExceptionState& ex
ceptionState) | 18 String CallbackFunctionTest::testCallback(ScriptState* scriptState, V8TestCallba
ck* callback, const String& message1, const String& message2, ExceptionState& ex
ceptionState) |
18 { | 19 { |
19 ScriptWrappable* scriptWrappable; | 20 ScriptWrappable* scriptWrappable; |
20 String returnValue; | 21 String returnValue; |
21 | 22 |
22 if (callback->call(scriptState, scriptWrappable = nullptr, message1, message
2, returnValue)) { | 23 if (callback->call(scriptState, scriptWrappable = nullptr, message1, message
2, returnValue)) { |
23 return String("SUCCESS: ") + returnValue; | 24 return String("SUCCESS: ") + returnValue; |
24 } | 25 } |
25 return String("Error!"); | 26 return String("Error!"); |
26 } | 27 } |
27 | 28 |
| 29 Vector<String> CallbackFunctionTest::testSequenceCallback(ScriptState* scriptSta
te, V8TestSequenceCallback* callback, const Vector<int>& numbers, ExceptionState
& exceptionState) |
| 30 { |
| 31 Vector<String> returnValue; |
| 32 if (callback->call(scriptState, nullptr, numbers, returnValue)) { |
| 33 return returnValue; |
| 34 } |
| 35 return Vector<String>(); |
| 36 } |
| 37 |
28 } // namespace blink | 38 } // namespace blink |
OLD | NEW |