| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "gin/converter.h" | 5 #include "gin/converter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "gin/public/isolate_holder.h" | 12 #include "gin/public/isolate_holder.h" |
| 13 #include "gin/test/v8_test.h" | 13 #include "gin/test/v8_test.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
| 16 | 16 |
| 17 namespace gin { |
| 18 |
| 17 using v8::Array; | 19 using v8::Array; |
| 18 using v8::Boolean; | 20 using v8::Boolean; |
| 19 using v8::HandleScope; | 21 using v8::HandleScope; |
| 20 using v8::Integer; | 22 using v8::Integer; |
| 21 using v8::Local; | 23 using v8::Local; |
| 22 using v8::Null; | 24 using v8::Null; |
| 23 using v8::Number; | 25 using v8::Number; |
| 24 using v8::Object; | 26 using v8::Object; |
| 25 using v8::String; | 27 using v8::String; |
| 26 using v8::Undefined; | 28 using v8::Undefined; |
| 27 using v8::Value; | 29 using v8::Value; |
| 28 | 30 |
| 29 namespace gin { | |
| 30 | |
| 31 typedef V8Test ConverterTest; | 31 typedef V8Test ConverterTest; |
| 32 | 32 |
| 33 TEST_F(ConverterTest, Bool) { | 33 TEST_F(ConverterTest, Bool) { |
| 34 HandleScope handle_scope(instance_->isolate()); | 34 HandleScope handle_scope(instance_->isolate()); |
| 35 | 35 |
| 36 EXPECT_TRUE(Converter<bool>::ToV8(instance_->isolate(), true)->StrictEquals( | 36 EXPECT_TRUE(Converter<bool>::ToV8(instance_->isolate(), true)->StrictEquals( |
| 37 Boolean::New(instance_->isolate(), true))); | 37 Boolean::New(instance_->isolate(), true))); |
| 38 EXPECT_TRUE(Converter<bool>::ToV8(instance_->isolate(), false)->StrictEquals( | 38 EXPECT_TRUE(Converter<bool>::ToV8(instance_->isolate(), false)->StrictEquals( |
| 39 Boolean::New(instance_->isolate(), false))); | 39 Boolean::New(instance_->isolate(), false))); |
| 40 | 40 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 ->StrictEquals(js_array->Get(static_cast<int>(i)))); | 125 ->StrictEquals(js_array->Get(static_cast<int>(i)))); |
| 126 } | 126 } |
| 127 | 127 |
| 128 std::vector<int> actual; | 128 std::vector<int> actual; |
| 129 EXPECT_TRUE(Converter<std::vector<int> >::FromV8(instance_->isolate(), | 129 EXPECT_TRUE(Converter<std::vector<int> >::FromV8(instance_->isolate(), |
| 130 js_array, &actual)); | 130 js_array, &actual)); |
| 131 EXPECT_EQ(expected, actual); | 131 EXPECT_EQ(expected, actual); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace gin | 134 } // namespace gin |
| OLD | NEW |