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

Unified Diff: ppapi/tests/test_websocket.cc

Issue 10944005: Pepper WebSocket API: Implement new design Chrome IPC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 8 years, 2 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/proxy/websocket_resource_unittest.cc ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('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 81ea021166f9ef7d55d70583aa5fc6b4edc3a5fe..2707b4f2aa889591fc5212ddbe94b1998db88750 100644
--- a/ppapi/tests/test_websocket.cc
+++ b/ppapi/tests/test_websocket.cc
@@ -1148,8 +1148,16 @@ std::string TestWebSocket::TestUtilityInvalidConnect() {
for (int i = 0; kInvalidURLs[i]; ++i) {
TestWebSocketAPI ws(instance_);
result = ws.Connect(pp::Var(std::string(kInvalidURLs[i])), protocols, 0U);
- ASSERT_EQ(PP_ERROR_BADARGUMENT, result);
- ASSERT_EQ(0U, ws.GetSeenEvents().size());
+ if (result == PP_OK_COMPLETIONPENDING) {
+ ws.WaitForClosed();
+ const std::vector<WebSocketEvent>& events = ws.GetSeenEvents();
+ ASSERT_EQ(WebSocketEvent::EVENT_ERROR, events[0].event_type);
+ ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[1].event_type);
+ ASSERT_EQ(2U, ws.GetSeenEvents().size());
+ } else {
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, result);
+ ASSERT_EQ(0U, ws.GetSeenEvents().size());
+ }
}
PASS();
@@ -1195,10 +1203,18 @@ std::string TestWebSocket::TestUtilityGetURL() {
TestWebSocketAPI websocket(instance_);
int32_t result = websocket.Connect(
pp::Var(std::string(kInvalidURLs[i])), protocols, 0U);
- ASSERT_EQ(PP_ERROR_BADARGUMENT, result);
+ if (result == PP_OK_COMPLETIONPENDING) {
+ websocket.WaitForClosed();
+ const std::vector<WebSocketEvent>& events = websocket.GetSeenEvents();
+ ASSERT_EQ(WebSocketEvent::EVENT_ERROR, events[0].event_type);
+ ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[1].event_type);
+ ASSERT_EQ(2U, events.size());
+ } else {
+ ASSERT_EQ(PP_ERROR_BADARGUMENT, result);
+ ASSERT_EQ(0U, websocket.GetSeenEvents().size());
+ }
pp::Var url = websocket.GetURL();
ASSERT_TRUE(AreEqualWithString(url.pp_var(), kInvalidURLs[i]));
- ASSERT_EQ(0U, websocket.GetSeenEvents().size());
}
PASS();
@@ -1337,7 +1353,6 @@ std::string TestWebSocket::TestUtilityGetProtocol() {
ASSERT_EQ(WebSocketEvent::EVENT_OPEN, events[0].event_type);
ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[1].event_type);
ASSERT_TRUE(AreEqualWithString(events[1].var.pp_var(), protocol.c_str()));
- ASSERT_TRUE(events[1].was_clean);
PASS();
}
« no previous file with comments | « ppapi/proxy/websocket_resource_unittest.cc ('k') | ppapi/thunk/interfaces_ppb_public_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698