OLD | NEW |
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 <cstring> | 5 #include <cstring> |
6 | 6 |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "ppapi/c/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
9 #include "ppapi/c/ppb_var.h" | 9 #include "ppapi/c/ppb_var.h" |
10 #include "ppapi/c/ppp_messaging.h" | 10 #include "ppapi/c/ppp_messaging.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 PPP_Messaging ppp_messaging_mock = { | 40 PPP_Messaging ppp_messaging_mock = { |
41 &HandleMessage | 41 &HandleMessage |
42 }; | 42 }; |
43 | 43 |
44 // Define a fake PPB_Var for the host side so that we can send a string var. | 44 // Define a fake PPB_Var for the host side so that we can send a string var. |
45 void AddRef(PP_Var /*var*/) { | 45 void AddRef(PP_Var /*var*/) { |
46 } | 46 } |
47 void Release(PP_Var /*var*/) { | 47 void Release(PP_Var /*var*/) { |
48 } | 48 } |
49 PP_Var VarFromUtf8(PP_Module /*module*/, const char* /*data*/, uint32_t len) { | 49 PP_Var VarFromUtf8(const char* /*data*/, uint32_t len) { |
50 return PP_MakeUndefined(); | 50 return PP_MakeUndefined(); |
51 } | 51 } |
52 // No matter what id we're given, always provide kTestString and its length. | 52 // No matter what id we're given, always provide kTestString and its length. |
53 const std::string kTestString = "Hello world!"; | 53 const std::string kTestString = "Hello world!"; |
54 const char* VarToUtf8(PP_Var /*var*/, uint32_t* len) { | 54 const char* VarToUtf8(PP_Var /*var*/, uint32_t* len) { |
55 *len = kTestString.size(); | 55 *len = kTestString.size(); |
56 return kTestString.c_str(); | 56 return kTestString.c_str(); |
57 } | 57 } |
58 | 58 |
59 PPB_Var ppb_var_mock = { | 59 PPB_Var ppb_var_mock = { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 EXPECT_EQ(kTestString, received_string->value()); | 133 EXPECT_EQ(kTestString, received_string->value()); |
134 // Now release the var, and the string should go away (because the ref | 134 // Now release the var, and the string should go away (because the ref |
135 // count should be one). | 135 // count should be one). |
136 plugin().var_tracker().ReleaseVar(received_var); | 136 plugin().var_tracker().ReleaseVar(received_var); |
137 EXPECT_FALSE(StringVar::FromPPVar(received_var)); | 137 EXPECT_FALSE(StringVar::FromPPVar(received_var)); |
138 } | 138 } |
139 | 139 |
140 } // namespace proxy | 140 } // namespace proxy |
141 } // namespace ppapi | 141 } // namespace ppapi |
142 | 142 |
OLD | NEW |