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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "sandbox/win/src/crosscall_client.h" | 6 #include "sandbox/win/src/crosscall_client.h" |
7 #include "sandbox/win/src/crosscall_server.h" | 7 #include "sandbox/win/src/crosscall_server.h" |
8 #include "sandbox/win/src/sharedmem_ipc_client.h" | 8 #include "sandbox/win/src/sharedmem_ipc_client.h" |
9 #include "sandbox/win/src/sharedmem_ipc_server.h" | 9 #include "sandbox/win/src/sharedmem_ipc_server.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 MakeChannels(kIPCChannelSize, 4096 * 4, &base_start); | 153 MakeChannels(kIPCChannelSize, 4096 * 4, &base_start); |
154 client_control->server_alive = HANDLE(1); | 154 client_control->server_alive = HANDLE(1); |
155 FixChannels(client_control, base_start, kIPCChannelSize, FIX_PONG_READY); | 155 FixChannels(client_control, base_start, kIPCChannelSize, FIX_PONG_READY); |
156 | 156 |
157 char* mem = reinterpret_cast<char*>(client_control); | 157 char* mem = reinterpret_cast<char*>(client_control); |
158 SharedMemIPCClient client(mem); | 158 SharedMemIPCClient client(mem); |
159 | 159 |
160 CrossCallReturn answer; | 160 CrossCallReturn answer; |
161 uint32 tag1 = 666; | 161 uint32 tag1 = 666; |
162 const wchar_t text[] = L"98765 - 43210"; | 162 const wchar_t text[] = L"98765 - 43210"; |
163 std::wstring copied_text; | 163 base::string16 copied_text; |
164 CrossCallParamsEx* actual_params; | 164 CrossCallParamsEx* actual_params; |
165 | 165 |
166 CrossCall(client, tag1, text, &answer); | 166 CrossCall(client, tag1, text, &answer); |
167 actual_params = reinterpret_cast<CrossCallParamsEx*>(client.GetBuffer()); | 167 actual_params = reinterpret_cast<CrossCallParamsEx*>(client.GetBuffer()); |
168 EXPECT_EQ(1, actual_params->GetParamsCount()); | 168 EXPECT_EQ(1, actual_params->GetParamsCount()); |
169 EXPECT_EQ(tag1, actual_params->GetTag()); | 169 EXPECT_EQ(tag1, actual_params->GetTag()); |
170 EXPECT_TRUE(actual_params->GetParameterStr(0, &copied_text)); | 170 EXPECT_TRUE(actual_params->GetParameterStr(0, &copied_text)); |
171 EXPECT_STREQ(text, copied_text.c_str()); | 171 EXPECT_STREQ(text, copied_text.c_str()); |
172 | 172 |
173 // Check with an empty string. | 173 // Check with an empty string. |
(...skipping 23 matching lines...) Expand all Loading... |
197 type = INVALID_TYPE; | 197 type = INVALID_TYPE; |
198 param_addr = actual_params->GetRawParameter(0, ¶m_size, &type); | 198 param_addr = actual_params->GetRawParameter(0, ¶m_size, &type); |
199 EXPECT_TRUE(NULL != param_addr); | 199 EXPECT_TRUE(NULL != param_addr); |
200 EXPECT_EQ(0, param_size); | 200 EXPECT_EQ(0, param_size); |
201 EXPECT_EQ(WCHAR_TYPE, type); | 201 EXPECT_EQ(WCHAR_TYPE, type); |
202 EXPECT_TRUE(actual_params->GetParameterStr(0, &copied_text)); | 202 EXPECT_TRUE(actual_params->GetParameterStr(0, &copied_text)); |
203 EXPECT_TRUE(actual_params->GetParameterStr(1, &copied_text)); | 203 EXPECT_TRUE(actual_params->GetParameterStr(1, &copied_text)); |
204 EXPECT_STREQ(text, copied_text.c_str()); | 204 EXPECT_STREQ(text, copied_text.c_str()); |
205 | 205 |
206 param_size = 1; | 206 param_size = 1; |
207 std::wstring copied_text_p0, copied_text_p2; | 207 base::string16 copied_text_p0, copied_text_p2; |
208 | 208 |
209 const wchar_t text2[] = L"AeFG"; | 209 const wchar_t text2[] = L"AeFG"; |
210 CrossCall(client, tag1, text2, null_text, text, &answer); | 210 CrossCall(client, tag1, text2, null_text, text, &answer); |
211 actual_params = reinterpret_cast<CrossCallParamsEx*>(client.GetBuffer()); | 211 actual_params = reinterpret_cast<CrossCallParamsEx*>(client.GetBuffer()); |
212 EXPECT_EQ(3, actual_params->GetParamsCount()); | 212 EXPECT_EQ(3, actual_params->GetParamsCount()); |
213 EXPECT_EQ(tag1, actual_params->GetTag()); | 213 EXPECT_EQ(tag1, actual_params->GetTag()); |
214 EXPECT_TRUE(actual_params->GetParameterStr(0, &copied_text_p0)); | 214 EXPECT_TRUE(actual_params->GetParameterStr(0, &copied_text_p0)); |
215 EXPECT_STREQ(text2, copied_text_p0.c_str()); | 215 EXPECT_STREQ(text2, copied_text_p0.c_str()); |
216 EXPECT_TRUE(actual_params->GetParameterStr(2, &copied_text_p2)); | 216 EXPECT_TRUE(actual_params->GetParameterStr(2, &copied_text_p2)); |
217 EXPECT_STREQ(text, copied_text_p2.c_str()); | 217 EXPECT_STREQ(text, copied_text_p2.c_str()); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 &call_return)); | 632 &call_return)); |
633 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); | 633 EXPECT_EQ(SBOX_ALL_OK, call_return.call_outcome); |
634 EXPECT_TRUE(bar == call_return.extended[0].handle); | 634 EXPECT_TRUE(bar == call_return.extended[0].handle); |
635 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); | 635 EXPECT_EQ(foo, call_return.extended[1].unsigned_int); |
636 | 636 |
637 CloseChannelEvents(client_control); | 637 CloseChannelEvents(client_control); |
638 delete[] reinterpret_cast<char*>(client_control); | 638 delete[] reinterpret_cast<char*>(client_control); |
639 } | 639 } |
640 | 640 |
641 } // namespace sandbox | 641 } // namespace sandbox |
OLD | NEW |