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 <string.h> | 7 #include <string.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ppapi/c/dev/ppb_testing_dev.h" | 10 #include "ppapi/c/dev/ppb_testing_dev.h" |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 ASSERT_EQ(0, ws.GetBufferedAmount()); | 565 ASSERT_EQ(0, ws.GetBufferedAmount()); |
566 ASSERT_EQ(0, ws.GetCloseCode()); | 566 ASSERT_EQ(0, ws.GetCloseCode()); |
567 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), "")); | 567 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), "")); |
568 ASSERT_EQ(false, ws.GetCloseWasClean()); | 568 ASSERT_EQ(false, ws.GetCloseWasClean()); |
569 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); | 569 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); |
570 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); | 570 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); |
571 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ws.GetReadyState()); | 571 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ws.GetReadyState()); |
572 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), "")); | 572 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), "")); |
573 | 573 |
574 // Check communication interfaces (connect, send, receive, and close). | 574 // Check communication interfaces (connect, send, receive, and close). |
575 ws.SetBinaryType(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV); | 575 ASSERT_TRUE(ws.SetBinaryType(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV)); |
576 TestCompletionCallback connect_callback(instance_->pp_instance()); | 576 TestCompletionCallback connect_callback(instance_->pp_instance()); |
577 int32_t result = ws.Connect(pp::Var(std::string(kCloseServerURL)), NULL, 0U, | 577 int32_t result = ws.Connect(pp::Var(std::string(kCloseServerURL)), NULL, 0U, |
578 connect_callback); | 578 connect_callback); |
579 ASSERT_EQ(PP_OK_COMPLETIONPENDING, result); | 579 ASSERT_EQ(PP_OK_COMPLETIONPENDING, result); |
580 result = connect_callback.WaitForResult(); | 580 result = connect_callback.WaitForResult(); |
581 ASSERT_EQ(PP_OK, result); | 581 ASSERT_EQ(PP_OK, result); |
582 | 582 |
583 std::string text_message("hello C++"); | 583 std::string text_message("hello C++"); |
584 result = ws.SendMessage(pp::Var(text_message)); | 584 result = ws.SendMessage(pp::Var(text_message)); |
585 ASSERT_EQ(PP_OK, result); | 585 ASSERT_EQ(PP_OK, result); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str())); | 623 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str())); |
624 ASSERT_EQ(true, ws.GetCloseWasClean()); | 624 ASSERT_EQ(true, ws.GetCloseWasClean()); |
625 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); | 625 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); |
626 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); | 626 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); |
627 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState()); | 627 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState()); |
628 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL)); | 628 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL)); |
629 ASSERT_EQ(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV, ws.GetBinaryType()); | 629 ASSERT_EQ(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV, ws.GetBinaryType()); |
630 | 630 |
631 PASS(); | 631 PASS(); |
632 } | 632 } |
OLD | NEW |