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

Side by Side Diff: ppapi/proxy/ppb_var_unittest.cc

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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
« no previous file with comments | « ppapi/proxy/ppb_var_proxy.cc ('k') | ppapi/proxy/ppb_video_capture_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "ppapi/c/pp_var.h" 9 #include "ppapi/c/pp_var.h"
10 #include "ppapi/c/ppb_var.h" 10 #include "ppapi/c/ppb_var.h"
11 #include "ppapi/proxy/ppapi_proxy_test.h" 11 #include "ppapi/proxy/ppapi_proxy_test.h"
12 #include "ppapi/proxy/ppb_var_proxy.h"
13 12
14 // TODO(dmichael): Make PPB_Var_Proxy and PluginResourceTracker thread-safe and 13 // TODO(dmichael): Make PPB_Var_Proxy and PluginResourceTracker thread-safe and
15 // add thread-safety tests here. 14 // add thread-safety tests here.
16 15
17 namespace { 16 namespace {
18 std::string VarToString(const PP_Var& var, const PPB_Var* ppb_var) { 17 std::string VarToString(const PP_Var& var, const PPB_Var* ppb_var) {
19 uint32_t len = 0; 18 uint32_t len = 0;
20 const char* utf8 = ppb_var->VarToUtf8(var, &len); 19 const char* utf8 = ppb_var->VarToUtf8(var, &len);
21 return std::string(utf8, len); 20 return std::string(utf8, len);
22 } 21 }
23 } // namespace 22 } // namespace
24 23
25 namespace ppapi { 24 namespace ppapi {
26 namespace proxy { 25 namespace proxy {
27 26
28 class PPB_VarTest : public PluginProxyTest { 27 class PPB_VarTest : public PluginProxyTest {
29 public: 28 public:
30 PPB_VarTest() {} 29 PPB_VarTest() {}
31 }; 30 };
32 31
33 TEST_F(PPB_VarTest, Strings) { 32 TEST_F(PPB_VarTest, Strings) {
34 const PPB_Var* ppb_var = GetPPB_Var_Interface(); 33 const PPB_Var* ppb_var = static_cast<const PPB_Var*>(
34 plugin_dispatcher()->GetInterfaceFromDispatcher(PPB_VAR_INTERFACE));
35 35
36 // Make a vector of strings, where the value of test_strings[i] is "i". 36 // Make a vector of strings, where the value of test_strings[i] is "i".
37 const int kNumStrings = 5; 37 const int kNumStrings = 5;
38 std::vector<std::string> test_strings(kNumStrings); 38 std::vector<std::string> test_strings(kNumStrings);
39 for (int i = 0; i < kNumStrings; ++i) 39 for (int i = 0; i < kNumStrings; ++i)
40 test_strings[i] = base::IntToString(i); 40 test_strings[i] = base::IntToString(i);
41 41
42 std::vector<PP_Var> vars(kNumStrings); 42 std::vector<PP_Var> vars(kNumStrings);
43 for (int i = 0; i < kNumStrings; ++i) { 43 for (int i = 0; i < kNumStrings; ++i) {
44 vars[i] = ppb_var->VarFromUtf8(pp_module(), 44 vars[i] = ppb_var->VarFromUtf8(pp_module(),
(...skipping 23 matching lines...) Expand all
68 uint32_t len = 10; 68 uint32_t len = 10;
69 const char* utf8 = ppb_var->VarToUtf8(vars[i], &len); 69 const char* utf8 = ppb_var->VarToUtf8(vars[i], &len);
70 EXPECT_EQ(NULL, utf8); 70 EXPECT_EQ(NULL, utf8);
71 EXPECT_EQ(0u, len); 71 EXPECT_EQ(0u, len);
72 } 72 }
73 } 73 }
74 74
75 } // namespace proxy 75 } // namespace proxy
76 } // namespace ppapi 76 } // namespace ppapi
77 77
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_var_proxy.cc ('k') | ppapi/proxy/ppb_video_capture_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698