Chromium Code Reviews| Index: ppapi/tests/test_websocket.cc |
| diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc |
| index 69502a192e18e15ada988f6557047b6e70995e7f..aad5c8e4ac66ce4768b9676145b33d020951c764 100644 |
| --- a/ppapi/tests/test_websocket.cc |
| +++ b/ppapi/tests/test_websocket.cc |
| @@ -652,29 +652,44 @@ std::string TestWebSocket::TestStressedSendReceive() { |
| for (uint32_t i = 0; i < binary.size(); ++i) |
| binary[i] = i; |
| PP_Var binary_var = CreateVarBinary(binary); |
| + // Prepare very large binary data over 64KB. Object serializer in ppapi_proxy |
| + // has a limitation of 64KB as maximum return PP_Var data size to SRPC. |
| + // In case received data over 64KB exists, a specific code handles this large |
| + // data via asynchronous callback from main thread. This data intends to test |
| + // the code. |
| + std::vector<uint8_t> large_binary(128 * 1024); |
|
dmichael (off chromium)
2012/04/06 17:12:12
Win XP has been giving me fits when testing large
Takashi Toyoshima
2012/04/11 11:28:45
Oh, I see.
65k looks big enough. I change this siz
|
| + for (uint32_t i = 0; i < large_binary.size(); ++i) |
| + large_binary[i] = i & 0xff; |
| + PP_Var large_binary_var = CreateVarBinary(large_binary); |
| // Send many messages. |
| + int32_t result; |
| for (int i = 0; i < 256; ++i) { |
| - int32_t result = websocket_interface_->SendMessage(ws, text_var); |
| + result = websocket_interface_->SendMessage(ws, text_var); |
| ASSERT_EQ(PP_OK, result); |
| result = websocket_interface_->SendMessage(ws, binary_var); |
| ASSERT_EQ(PP_OK, result); |
| } |
| + result = websocket_interface_->SendMessage(ws, large_binary_var); |
|
dmichael (off chromium)
2012/04/06 17:12:12
Would it be possible to also add a test where you
Takashi Toyoshima
2012/04/11 11:28:45
Done.
|
| + ASSERT_EQ(PP_OK, result); |
| ReleaseVar(text_var); |
| ReleaseVar(binary_var); |
| + ReleaseVar(large_binary_var); |
| // Receive echoed data. |
| - for (int i = 0; i < 512; ++i) { |
| + for (int i = 0; i <= 512; ++i) { |
| TestCompletionCallback callback(instance_->pp_instance(), force_async_); |
| PP_Var received_message; |
| - int32_t result = websocket_interface_->ReceiveMessage( |
| + result = websocket_interface_->ReceiveMessage( |
| ws, &received_message, static_cast<pp::CompletionCallback>( |
| callback).pp_completion_callback()); |
| ASSERT_TRUE(result == PP_OK || result == PP_OK_COMPLETIONPENDING); |
| if (result == PP_OK_COMPLETIONPENDING) |
| result = callback.WaitForResult(); |
| ASSERT_EQ(PP_OK, result); |
| - if (i & 1) { |
| + if (i == 512) { |
| + ASSERT_TRUE(AreEqualWithBinary(received_message, large_binary)); |
| + } else if (i & 1) { |
| ASSERT_TRUE(AreEqualWithBinary(received_message, binary)); |
| } else { |
| ASSERT_TRUE(AreEqualWithString(received_message, text)); |