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

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: (not for review: fix win build) 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
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();

Powered by Google App Engine
This is Rietveld 408576698