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

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

Issue 9169052: Tweaks to PPB_VarArrayBuffer in preperation for taking out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes based on reviews 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/tests/test_post_message.cc ('k') | webkit/plugins/ppapi/host_array_buffer_var.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 if (utf8_length != string_length) 106 if (utf8_length != string_length)
107 return false; 107 return false;
108 if (strncmp(utf8, string, utf8_length)) 108 if (strncmp(utf8, string, utf8_length))
109 return false; 109 return false;
110 return true; 110 return true;
111 } 111 }
112 112
113 bool TestWebSocket::AreEqualWithBinary(const PP_Var& var, 113 bool TestWebSocket::AreEqualWithBinary(const PP_Var& var,
114 const uint8_t* data, 114 const uint8_t* data,
115 uint32_t size) { 115 uint32_t size) {
116 if (arraybuffer_interface_->ByteLength(var) != size) 116 uint32_t buffer_size = 0;
117 PP_Bool success = arraybuffer_interface_->ByteLength(var, &buffer_size);
118 if (!success || buffer_size != size)
117 return false; 119 return false;
118 if (memcmp(arraybuffer_interface_->Map(var), data, size)) 120 if (memcmp(arraybuffer_interface_->Map(var), data, size))
119 return false; 121 return false;
120 return true; 122 return true;
121 } 123 }
122 124
123 PP_Resource TestWebSocket::Connect( 125 PP_Resource TestWebSocket::Connect(
124 const char* url, int32_t* result, const char* protocol) { 126 const char* url, int32_t* result, const char* protocol) {
125 PP_Var protocols[] = { PP_MakeUndefined() }; 127 PP_Var protocols[] = { PP_MakeUndefined() };
126 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance()); 128 PP_Resource ws = websocket_interface_->Create(instance_->pp_instance());
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str())); 625 ASSERT_TRUE(AreEqualWithString(ws.GetCloseReason().pp_var(), reason.c_str()));
624 ASSERT_EQ(true, ws.GetCloseWasClean()); 626 ASSERT_EQ(true, ws.GetCloseWasClean());
625 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), "")); 627 ASSERT_TRUE(AreEqualWithString(ws.GetExtensions().pp_var(), ""));
626 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), "")); 628 ASSERT_TRUE(AreEqualWithString(ws.GetProtocol().pp_var(), ""));
627 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState()); 629 ASSERT_EQ(PP_WEBSOCKETREADYSTATE_CLOSED_DEV, ws.GetReadyState());
628 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL)); 630 ASSERT_TRUE(AreEqualWithString(ws.GetURL().pp_var(), kCloseServerURL));
629 ASSERT_EQ(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV, ws.GetBinaryType()); 631 ASSERT_EQ(PP_WEBSOCKETBINARYTYPE_ARRAYBUFFER_DEV, ws.GetBinaryType());
630 632
631 PASS(); 633 PASS();
632 } 634 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_post_message.cc ('k') | webkit/plugins/ppapi/host_array_buffer_var.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698