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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/NativeValueTraitsImplTest.cpp

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "bindings/core/v8/NativeValueTraitsImpl.h" 5 #include "bindings/core/v8/NativeValueTraitsImpl.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include "bindings/core/v8/ExceptionState.h" 8 #include "bindings/core/v8/ExceptionState.h"
9 #include "bindings/core/v8/IDLTypes.h" 9 #include "bindings/core/v8/IDLTypes.h"
10 #include "bindings/core/v8/TestSequenceCallback.h" 10 #include "bindings/core/v8/TestSequenceCallback.h"
11 #include "bindings/core/v8/ToV8.h" 11 #include "bindings/core/v8/ToV8.h"
12 #include "bindings/core/v8/V8BindingForTesting.h" 12 #include "bindings/core/v8/V8BindingForTesting.h"
13 #include "bindings/core/v8/V8Internals.h" 13 #include "bindings/core/v8/V8Internals.h"
14 #include "platform/wtf/Vector.h" 14 #include "platform/wtf/Vector.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 namespace blink { 17 namespace blink {
18 18
19 namespace { 19 namespace {
20 20
21 template <typename T> 21 template <typename T>
22 v8::Local<v8::Value> ToV8(V8TestingScope* scope, T value) { 22 v8::Local<v8::Value> ToV8(V8TestingScope* scope, T value) {
23 return blink::ToV8(value, scope->context()->Global(), scope->isolate()); 23 return blink::ToV8(value, scope->context()->Global(), scope->isolate());
24 } 24 }
25 25
26 TEST(NativeValueTraitsImplTest, IDLInterface) { 26 TEST(NativeValueTraitsImplTest, IDLInterface) {
27 V8TestingScope scope; 27 V8TestingScope scope;
28 { 28 {
29 DummyExceptionStateForTesting exceptionState; 29 DummyExceptionStateForTesting exceptionState;
30 Internals* internals = NativeValueTraits<Internals>::nativeValue( 30 Internals* internals = NativeValueTraits<Internals>::NativeValue(
31 scope.isolate(), v8::Number::New(scope.isolate(), 42), exceptionState); 31 scope.isolate(), v8::Number::New(scope.isolate(), 42), exceptionState);
32 EXPECT_TRUE(exceptionState.hadException()); 32 EXPECT_TRUE(exceptionState.hadException());
33 EXPECT_EQ("Unable to convert value to Internals.", 33 EXPECT_EQ("Unable to convert value to Internals.",
34 exceptionState.message()); 34 exceptionState.message());
35 EXPECT_EQ(nullptr, internals); 35 EXPECT_EQ(nullptr, internals);
36 } 36 }
37 { 37 {
38 DummyExceptionStateForTesting exceptionState; 38 DummyExceptionStateForTesting exceptionState;
39 TestSequenceCallback* callbackFunction = 39 TestSequenceCallback* callbackFunction =
40 NativeValueTraits<TestSequenceCallback>::nativeValue( 40 NativeValueTraits<TestSequenceCallback>::NativeValue(
41 scope.isolate(), v8::Undefined(scope.isolate()), exceptionState); 41 scope.isolate(), v8::Undefined(scope.isolate()), exceptionState);
42 EXPECT_TRUE(exceptionState.hadException()); 42 EXPECT_TRUE(exceptionState.hadException());
43 EXPECT_EQ("Unable to convert value to TestSequenceCallback.", 43 EXPECT_EQ("Unable to convert value to TestSequenceCallback.",
44 exceptionState.message()); 44 exceptionState.message());
45 EXPECT_EQ(nullptr, callbackFunction); 45 EXPECT_EQ(nullptr, callbackFunction);
46 } 46 }
47 } 47 }
48 48
49 void ThrowException(v8::Local<v8::Name>, 49 void ThrowException(v8::Local<v8::Name>,
50 const v8::PropertyCallbackInfo<v8::Value>& info) { 50 const v8::PropertyCallbackInfo<v8::Value>& info) {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 EXPECT_EQ(1U, record.size()); 261 EXPECT_EQ(1U, record.size());
262 EXPECT_EQ("foo", record[0].first); 262 EXPECT_EQ("foo", record[0].first);
263 EXPECT_EQ("Hello, World!", record[0].second[0]); 263 EXPECT_EQ("Hello, World!", record[0].second[0]);
264 EXPECT_EQ("Hi, Mom!", record[0].second[1]); 264 EXPECT_EQ("Hi, Mom!", record[0].second[1]);
265 } 265 }
266 } 266 }
267 267
268 } // namespace 268 } // namespace
269 269
270 } // namespace blink 270 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698