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

Unified Diff: ppapi/tests/test_websocket.cc

Issue 10169036: WebSocket Pepper API: the second Close() should not return error code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix grammar nits Created 8 years, 8 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
« no previous file with comments | « ppapi/cpp/websocket.h ('k') | webkit/plugins/ppapi/ppb_websocket_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_websocket.cc
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc
index eff333ad5e3c02c738da6813fb7f6ff309495406..11a4260a66d605cb47f42c619176ed2ccf7e657e 100644
--- a/ppapi/tests/test_websocket.cc
+++ b/ppapi/tests/test_websocket.cc
@@ -502,6 +502,31 @@ std::string TestWebSocket::TestInvalidClose() {
ReleaseVar(receive_message_var);
core_interface_->ReleaseResource(ws);
+ // Close twice.
+ ws = Connect(GetFullURL(kEchoServerURL), &result, "");
+ ASSERT_TRUE(ws);
+ ASSERT_EQ(PP_OK, result);
+ result = websocket_interface_->Close(ws,
+ PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE, reason,
+ callback.GetCallback().pp_completion_callback());
+ ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
+ // Call another Close() before previous one is in progress.
+ result = websocket_interface_->Close(ws,
+ PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE, reason,
+ another_callback.GetCallback().pp_completion_callback());
+ ASSERT_EQ(PP_ERROR_INPROGRESS, result);
+ result = callback.WaitForResult();
+ ASSERT_EQ(PP_OK, result);
+ // Call another Close() after previous one is completed.
+ // This Close() must do nothing and reports no error.
+ result = websocket_interface_->Close(ws,
+ PP_WEBSOCKETSTATUSCODE_NORMAL_CLOSURE, reason,
+ callback.GetCallback().pp_completion_callback());
+ if (result == PP_OK_COMPLETIONPENDING)
+ result = callback.WaitForResult();
+ ASSERT_EQ(PP_OK, result);
+ core_interface_->ReleaseResource(ws);
+
ReleaseVar(reason);
PASS();
« no previous file with comments | « ppapi/cpp/websocket.h ('k') | webkit/plugins/ppapi/ppb_websocket_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698