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

Unified Diff: ppapi/tests/test_websocket.cc

Issue 9802027: WebSocket Pepper API: synchronous completion support (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add large data over 64KB to stressed test Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
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));

Powered by Google App Engine
This is Rietveld 408576698