Index: ppapi/tests/test_websocket.cc |
diff --git a/ppapi/tests/test_websocket.cc b/ppapi/tests/test_websocket.cc |
index 81ea021166f9ef7d55d70583aa5fc6b4edc3a5fe..b519fa5b653b5e8ca3e16c1503aa704160f206ed 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(); |