Index: third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp b/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp |
index 3e2e56ce433177b5b90a03ed9ba6b1117f852ecc..d9d8c3938923b55a0a903150b8a82afa47464dfb 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp |
@@ -7,8 +7,10 @@ |
#include <utility> |
#include "bindings/core/v8/ExceptionState.h" |
#include "bindings/core/v8/IDLTypes.h" |
+#include "bindings/core/v8/TestSequenceCallback.h" |
#include "bindings/core/v8/ToV8.h" |
#include "bindings/core/v8/V8BindingForTesting.h" |
+#include "bindings/core/v8/V8Internals.h" |
#include "platform/wtf/Vector.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -21,6 +23,29 @@ v8::Local<v8::Value> ToV8(V8TestingScope* scope, T value) { |
return blink::ToV8(value, scope->context()->Global(), scope->isolate()); |
} |
+TEST(NativeValueTraitsImplTest, IDLInterface) { |
+ V8TestingScope scope; |
+ { |
+ DummyExceptionStateForTesting exceptionState; |
+ Internals* internals = NativeValueTraits<Internals>::nativeValue( |
+ scope.isolate(), v8::Number::New(scope.isolate(), 42), exceptionState); |
+ EXPECT_TRUE(exceptionState.hadException()); |
+ EXPECT_EQ("Unable to convert value to Internals.", |
+ exceptionState.message()); |
+ EXPECT_EQ(nullptr, internals); |
+ } |
+ { |
+ DummyExceptionStateForTesting exceptionState; |
+ TestSequenceCallback* callbackFunction = |
+ NativeValueTraits<TestSequenceCallback>::nativeValue( |
+ scope.isolate(), v8::Undefined(scope.isolate()), exceptionState); |
+ EXPECT_TRUE(exceptionState.hadException()); |
+ EXPECT_EQ("Unable to convert value to TestSequenceCallback.", |
+ exceptionState.message()); |
+ EXPECT_EQ(nullptr, callbackFunction); |
+ } |
+} |
+ |
void ThrowException(v8::Local<v8::Name>, |
const v8::PropertyCallbackInfo<v8::Value>& info) { |
info.GetIsolate()->ThrowException(v8String(info.GetIsolate(), "bogus!")); |