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" |
11 #include "ppapi/proxy/ppapi_proxy_test.h" | 11 #include "ppapi/proxy/ppapi_proxy_test.h" |
12 #include "ppapi/shared_impl/var.h" | 12 #include "ppapi/shared_impl/var.h" |
13 | 13 |
14 using ::ppapi::StringVar; | 14 namespace ppapi { |
15 | |
16 namespace pp { | |
17 namespace proxy { | 15 namespace proxy { |
18 | 16 |
19 namespace { | 17 namespace { |
20 | 18 |
21 // This is a poor man's mock of PPP_Messaging using global variables. Eventually | 19 // This is a poor man's mock of PPP_Messaging using global variables. Eventually |
22 // we should generalize making PPAPI interface mocks by using IDL or macro/ | 20 // we should generalize making PPAPI interface mocks by using IDL or macro/ |
23 // template magic. | 21 // template magic. |
24 PP_Instance received_instance; | 22 PP_Instance received_instance; |
25 PP_Var received_var; | 23 PP_Var received_var; |
26 base::WaitableEvent handle_message_called(false, false); | 24 base::WaitableEvent handle_message_called(false, false); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 scoped_refptr<StringVar> received_string(StringVar::FromPPVar(received_var)); | 131 scoped_refptr<StringVar> received_string(StringVar::FromPPVar(received_var)); |
134 ASSERT_TRUE(received_string.get()); | 132 ASSERT_TRUE(received_string.get()); |
135 EXPECT_EQ(kTestString, received_string->value()); | 133 EXPECT_EQ(kTestString, received_string->value()); |
136 // 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 |
137 // count should be one). | 135 // count should be one). |
138 plugin().var_tracker().ReleaseVar(received_var); | 136 plugin().var_tracker().ReleaseVar(received_var); |
139 EXPECT_FALSE(StringVar::FromPPVar(received_var).get()); | 137 EXPECT_FALSE(StringVar::FromPPVar(received_var).get()); |
140 } | 138 } |
141 | 139 |
142 } // namespace proxy | 140 } // namespace proxy |
143 } // namespace pp | 141 } // namespace ppapi |
144 | 142 |
OLD | NEW |