diff options
author | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 11:39:07 +0000 |
---|---|---|
committer | toyoshim@chromium.org <toyoshim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 11:39:07 +0000 |
commit | 9c8b2fd3e1451243ef8e1b6fbe8f7325b7566a3c (patch) | |
tree | a2c843b405f0bb52b859f71dbaf2f88c8d5cf43a /ppapi/tests | |
parent | 6a6d0edd5ffcd8eb6b16be2376e2aba00cb961aa (diff) | |
download | chromium_src-9c8b2fd3e1451243ef8e1b6fbe8f7325b7566a3c.zip chromium_src-9c8b2fd3e1451243ef8e1b6fbe8f7325b7566a3c.tar.gz chromium_src-9c8b2fd3e1451243ef8e1b6fbe8f7325b7566a3c.tar.bz2 |
WebSocket Pepper API: the second Close() should not return error code.
The WebSocket API defines that call to Close() on CLOSED state must do nothing
and cause no error. Currently Pepper API returns PP_ERROR_INPROGRESS. This
error code is confusing. We should return PP_OK here.
BUG=124866
TEST=browser_tests --gtest_filter='*WebSocket*'
Review URL: http://codereview.chromium.org/10169036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133894 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r-- | ppapi/tests/test_websocket.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc index eff333a..11a4260 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(); |