OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/tests/test_websocket.h" | 5 #include "ppapi/tests/test_websocket.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } | 457 } |
458 | 458 |
459 std::string TestWebSocket::TestValidConnect() { | 459 std::string TestWebSocket::TestValidConnect() { |
460 int32_t result; | 460 int32_t result; |
461 PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, ""); | 461 PP_Resource ws = Connect(GetFullURL(kEchoServerURL), &result, ""); |
462 ASSERT_TRUE(ws); | 462 ASSERT_TRUE(ws); |
463 ASSERT_EQ(PP_OK, result); | 463 ASSERT_EQ(PP_OK, result); |
464 PP_Var extensions = websocket_interface_->GetExtensions(ws); | 464 PP_Var extensions = websocket_interface_->GetExtensions(ws); |
465 ASSERT_TRUE(AreEqualWithString(extensions, "")); | 465 ASSERT_TRUE(AreEqualWithString(extensions, "")); |
466 core_interface_->ReleaseResource(ws); | 466 core_interface_->ReleaseResource(ws); |
| 467 ReleaseVar(extensions); |
467 | 468 |
468 PASS(); | 469 PASS(); |
469 } | 470 } |
470 | 471 |
471 std::string TestWebSocket::TestInvalidClose() { | 472 std::string TestWebSocket::TestInvalidClose() { |
472 PP_Var reason = CreateVarString("close for test"); | 473 PP_Var reason = CreateVarString("close for test"); |
473 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); | 474 TestCompletionCallback callback(instance_->pp_instance(), callback_type()); |
474 TestCompletionCallback async_callback(instance_->pp_instance(), PP_REQUIRED); | 475 TestCompletionCallback async_callback(instance_->pp_instance(), PP_REQUIRED); |
475 | 476 |
476 // Close before connect. | 477 // Close before connect. |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 size_t last_event = events_on_closed - 1; | 1505 size_t last_event = events_on_closed - 1; |
1505 for (uint32_t i = 1; i < last_event; ++i) { | 1506 for (uint32_t i = 1; i < last_event; ++i) { |
1506 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); | 1507 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); |
1507 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); | 1508 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); |
1508 } | 1509 } |
1509 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); | 1510 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); |
1510 ASSERT_TRUE(events[last_event].was_clean); | 1511 ASSERT_TRUE(events[last_event].was_clean); |
1511 | 1512 |
1512 PASS(); | 1513 PASS(); |
1513 } | 1514 } |
OLD | NEW |