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

Side by Side Diff: ppapi/tests/test_websocket.cc

Issue 9026007: WebSocket Pepper API: WebArrayBuffer support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: wen32 build catch missing PP_ToBool Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/dev/websocket_dev.cc ('k') | webkit/plugins/ppapi/ppb_websocket_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 ReleaseVar(protocol); 190 ReleaseVar(protocol);
191 191
192 PP_WebSocketReadyState_Dev ready_state = 192 PP_WebSocketReadyState_Dev ready_state =
193 websocket_interface_->GetReadyState(ws); 193 websocket_interface_->GetReadyState(ws);
194 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ready_state); 194 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ready_state);
195 195
196 PP_Var url = websocket_interface_->GetURL(ws); 196 PP_Var url = websocket_interface_->GetURL(ws);
197 ASSERT_TRUE(AreEqualWithString(url, "")); 197 ASSERT_TRUE(AreEqualWithString(url, ""));
198 ReleaseVar(url); 198 ReleaseVar(url);
199 199
200 PP_WebSocketBinaryType_Dev binary_type =
201 websocket_interface_->GetBinaryType(ws);
202 ASSERT_EQ(PP_WEBSOCKETBINARYTYPE_BLOB_DEV, binary_type);
203
200 core_interface_->ReleaseResource(ws); 204 core_interface_->ReleaseResource(ws);
201 205
202 PASS(); 206 PASS();
203 } 207 }
204 208
205 std::string TestWebSocket::TestInvalidConnect() { 209 std::string TestWebSocket::TestInvalidConnect() {
206 PP_Var protocols[] = { PP_MakeUndefined() }; 210 PP_Var protocols[] = { PP_MakeUndefined() };
207 211
208 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance()); 212 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance());
209 ASSERT_TRUE(ws); 213 ASSERT_TRUE(ws);
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 ASSERT_EQ(0, ws.GetBufferedAmount()); 561 ASSERT_EQ(0, ws.GetBufferedAmount());
558 ASSERT_EQ(0, ws.GetCloseCode()); 562 ASSERT_EQ(0, ws.GetCloseCode());
559 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), "")); 563 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), ""));
560 ASSERT_EQ(false, ws.GetCloseWasClean()); 564 ASSERT_EQ(false, ws.GetCloseWasClean());
561 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); 565 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), ""));
562 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); 566 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), ""));
563 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ws.GetReadyState()); 567 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_INVALID_DEV, ws.GetReadyState());
564 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), "")); 568 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), ""));
565 569
566 // Check communication interfaces (connect, send, receive, and close). 570 // Check communication interfaces (connect, send, receive, and close).
571 ws.SetBinaryType(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV);
567 TestCompletionCallback connect_callback(instance_->pp_instance()); 572 TestCompletionCallback connect_callback(instance_->pp_instance());
568 int32_t result = ws.Connect(pp::Var(std::string(kCloseServerURL)), NULL, 0U, 573 int32_t result = ws.Connect(pp::Var(std::string(kCloseServerURL)), NULL, 0U,
569 connect_callback); 574 connect_callback);
570 ASSERT_EQ(PP_OK_COMPLETIONPENDING, result); 575 ASSERT_EQ(PP_OK_COMPLETIONPENDING, result);
571 result = connect_callback.WaitForResult(); 576 result = connect_callback.WaitForResult();
572 ASSERT_EQ(PP_OK, result); 577 ASSERT_EQ(PP_OK, result);
573 578
574 std::string text_message("hello C++"); 579 std::string text_message("hello C++");
575 result = ws.SendMessage(pp::Var(text_message)); 580 result = ws.SendMessage(pp::Var(text_message));
576 ASSERT_EQ(PP_OK, result); 581 ASSERT_EQ(PP_OK, result);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 615
611 // Check initialized properties access. 616 // Check initialized properties access.
612 ASSERT_EQ(0, ws.GetBufferedAmount()); 617 ASSERT_EQ(0, ws.GetBufferedAmount());
613 ASSERT_EQ(kCloseCodeNormalClosure, ws.GetCloseCode()); 618 ASSERT_EQ(kCloseCodeNormalClosure, ws.GetCloseCode());
614 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str())); 619 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str()));
615 ASSERT_EQ(true, ws.GetCloseWasClean()); 620 ASSERT_EQ(true, ws.GetCloseWasClean());
616 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); 621 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), ""));
617 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); 622 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), ""));
618 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState()); 623 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState());
619 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL)); 624 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL));
625 ASSERT_EQ(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV, ws.GetBinaryType());
620 626
621 PASS(); 627 PASS();
622 } 628 }
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/websocket_dev.cc ('k') | webkit/plugins/ppapi/ppb_websocket_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698