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

Side by Side Diff: webkit/glue/cpp_variant_unittest.cc

Issue 10382059: Quote CppBoundClass/CppVariant in namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a long line Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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/glue/cpp_variant.h"
12 12
13 using WebKit::WebBindings; 13 using WebKit::WebBindings;
14 using webkit_glue::CppVariant;
14 15
15 // 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
16 // is not a string, empties the std::string. 17 // is not a string, empties the std::string.
17 void MakeStdString(const NPVariant& np, std::string* std_string) { 18 void MakeStdString(const NPVariant& np, std::string* std_string) {
18 if (np.type == NPVariantType_String) { 19 if (np.type == NPVariantType_String) {
19 const char* chars = 20 const char* chars =
20 reinterpret_cast<const char*>(np.value.stringValue.UTF8Characters); 21 reinterpret_cast<const char*>(np.value.stringValue.UTF8Characters);
21 (*std_string).assign(chars, np.value.stringValue.UTF8Length); 22 (*std_string).assign(chars, np.value.stringValue.UTF8Length);
22 } else { 23 } else {
23 (*std_string).clear(); 24 (*std_string).clear();
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 EXPECT_TRUE(cpp_vector[1].isBool()); 485 EXPECT_TRUE(cpp_vector[1].isBool());
485 EXPECT_EQ(true, cpp_vector[1].ToBoolean()); 486 EXPECT_EQ(true, cpp_vector[1].ToBoolean());
486 487
487 EXPECT_TRUE(cpp_vector[2].isNull()); 488 EXPECT_TRUE(cpp_vector[2].isNull());
488 489
489 EXPECT_TRUE(cpp_vector[3].isString()); 490 EXPECT_TRUE(cpp_vector[3].isString());
490 CheckString("string", cpp_vector[3]); 491 CheckString("string", cpp_vector[3]);
491 492
492 WebBindings::releaseObject(obj); 493 WebBindings::releaseObject(obj);
493 } 494 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698