| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 11 #include "webkit/glue/cpp_variant.h" | 11 #include "webkit/renderer/cpp_variant.h" |
| 12 | 12 |
| 13 using WebKit::WebBindings; | 13 using WebKit::WebBindings; |
| 14 using webkit_glue::CppVariant; | 14 using webkit_glue::CppVariant; |
| 15 | 15 |
| 16 // Creates a std::string from an NPVariant of string type. If the NPVariant | 16 // Creates a std::string from an NPVariant of string type. If the NPVariant |
| 17 // is not a string, empties the std::string. | 17 // is not a string, empties the std::string. |
| 18 void MakeStdString(const NPVariant& np, std::string* std_string) { | 18 void MakeStdString(const NPVariant& np, std::string* std_string) { |
| 19 if (np.type == NPVariantType_String) { | 19 if (np.type == NPVariantType_String) { |
| 20 const char* chars = | 20 const char* chars = |
| 21 reinterpret_cast<const char*>(np.value.stringValue.UTF8Characters); | 21 reinterpret_cast<const char*>(np.value.stringValue.UTF8Characters); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 EXPECT_TRUE(cpp_vector[1].isBool()); | 485 EXPECT_TRUE(cpp_vector[1].isBool()); |
| 486 EXPECT_EQ(true, cpp_vector[1].ToBoolean()); | 486 EXPECT_EQ(true, cpp_vector[1].ToBoolean()); |
| 487 | 487 |
| 488 EXPECT_TRUE(cpp_vector[2].isNull()); | 488 EXPECT_TRUE(cpp_vector[2].isNull()); |
| 489 | 489 |
| 490 EXPECT_TRUE(cpp_vector[3].isString()); | 490 EXPECT_TRUE(cpp_vector[3].isString()); |
| 491 CheckString("string", cpp_vector[3]); | 491 CheckString("string", cpp_vector[3]); |
| 492 | 492 |
| 493 WebBindings::releaseObject(obj); | 493 WebBindings::releaseObject(obj); |
| 494 } | 494 } |
| OLD | NEW |