| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" | 7 #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" |
| 8 #include "webkit/glue/cpp_variant.h" | 8 #include "webkit/glue/cpp_variant.h" |
| 9 | 9 |
| 10 using WebKit::WebBindings; | 10 using WebKit::WebBindings; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 cpp.Set(np); | 266 cpp.Set(np); |
| 267 // Use this or WebBindings::releaseObject but NOT both. | 267 // Use this or WebBindings::releaseObject but NOT both. |
| 268 WebBindings::releaseVariantValue(&np); | 268 WebBindings::releaseVariantValue(&np); |
| 269 CheckObject(cpp); | 269 CheckObject(cpp); |
| 270 } | 270 } |
| 271 | 271 |
| 272 TEST(CppVariantTest, SetsSimpleTypesAndValues) { | 272 TEST(CppVariantTest, SetsSimpleTypesAndValues) { |
| 273 CppVariant cpp; | 273 CppVariant cpp; |
| 274 cpp.Set(true); | 274 cpp.Set(true); |
| 275 EXPECT_EQ(NPVariantType_Bool, cpp.type); | 275 EXPECT_EQ(NPVariantType_Bool, cpp.type); |
| 276 EXPECT_EQ(true, cpp.value.boolValue); | 276 EXPECT_TRUE(cpp.value.boolValue); |
| 277 | 277 |
| 278 cpp.Set(5); | 278 cpp.Set(5); |
| 279 EXPECT_EQ(NPVariantType_Int32, cpp.type); | 279 EXPECT_EQ(NPVariantType_Int32, cpp.type); |
| 280 EXPECT_EQ(5, cpp.value.intValue); | 280 EXPECT_EQ(5, cpp.value.intValue); |
| 281 | 281 |
| 282 cpp.Set(1.234); | 282 cpp.Set(1.234); |
| 283 EXPECT_EQ(NPVariantType_Double, cpp.type); | 283 EXPECT_EQ(NPVariantType_Double, cpp.type); |
| 284 EXPECT_EQ(1.234, cpp.value.doubleValue); | 284 EXPECT_EQ(1.234, cpp.value.doubleValue); |
| 285 | 285 |
| 286 // C string | 286 // C string |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 EXPECT_FALSE(cpp.isDouble()); | 417 EXPECT_FALSE(cpp.isDouble()); |
| 418 EXPECT_FALSE(cpp.isNumber()); | 418 EXPECT_FALSE(cpp.isNumber()); |
| 419 EXPECT_FALSE(cpp.isString()); | 419 EXPECT_FALSE(cpp.isString()); |
| 420 EXPECT_FALSE(cpp.isVoid()); | 420 EXPECT_FALSE(cpp.isVoid()); |
| 421 EXPECT_FALSE(cpp.isNull()); | 421 EXPECT_FALSE(cpp.isNull()); |
| 422 EXPECT_FALSE(cpp.isEmpty()); | 422 EXPECT_FALSE(cpp.isEmpty()); |
| 423 EXPECT_TRUE(cpp.isObject()); | 423 EXPECT_TRUE(cpp.isObject()); |
| 424 WebBindings::releaseObject(obj); | 424 WebBindings::releaseObject(obj); |
| 425 CheckObject(cpp); | 425 CheckObject(cpp); |
| 426 } | 426 } |
| OLD | NEW |