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

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

Issue 915403003: Enable size_t to int truncation warnings in PPAPI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ppapi_unittests win x64 Created 5 years, 10 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
« no previous file with comments | « ppapi/tests/test_url_request.cc ('k') | no next file » | 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 <stdio.h> 7 #include <stdio.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 char buffer[10]; 252 char buffer[10];
253 sprintf(buffer, ":%d", instance_->websocket_port()); 253 sprintf(buffer, ":%d", instance_->websocket_port());
254 rv += std::string(buffer); 254 rv += std::string(buffer);
255 } 255 }
256 rv += "/"; 256 rv += "/";
257 rv += url; 257 rv += url;
258 return rv; 258 return rv;
259 } 259 }
260 260
261 PP_Var TestWebSocket::CreateVarString(const std::string& string) { 261 PP_Var TestWebSocket::CreateVarString(const std::string& string) {
262 return var_interface_->VarFromUtf8(string.c_str(), string.size()); 262 return var_interface_->VarFromUtf8(string.c_str(),
263 static_cast<uint32_t>(string.size()));
263 } 264 }
264 265
265 PP_Var TestWebSocket::CreateVarBinary(const std::vector<uint8_t>& binary) { 266 PP_Var TestWebSocket::CreateVarBinary(const std::vector<uint8_t>& binary) {
266 PP_Var var = arraybuffer_interface_->Create(binary.size()); 267 PP_Var var =
268 arraybuffer_interface_->Create(static_cast<uint32_t>(binary.size()));
267 uint8_t* var_data = static_cast<uint8_t*>(arraybuffer_interface_->Map(var)); 269 uint8_t* var_data = static_cast<uint8_t*>(arraybuffer_interface_->Map(var));
268 std::copy(binary.begin(), binary.end(), var_data); 270 std::copy(binary.begin(), binary.end(), var_data);
269 return var; 271 return var;
270 } 272 }
271 273
272 void TestWebSocket::ReleaseVar(const PP_Var& var) { 274 void TestWebSocket::ReleaseVar(const PP_Var& var) {
273 var_interface_->Release(var); 275 var_interface_->Release(var);
274 } 276 }
275 277
276 bool TestWebSocket::AreEqualWithString(const PP_Var& var, 278 bool TestWebSocket::AreEqualWithString(const PP_Var& var,
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 size_t last_event = events_on_closed - 1; 1609 size_t last_event = events_on_closed - 1;
1608 for (uint32_t i = 1; i < last_event; ++i) { 1610 for (uint32_t i = 1; i < last_event; ++i) {
1609 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type); 1611 ASSERT_EQ(WebSocketEvent::EVENT_MESSAGE, events[i].event_type);
1610 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message)); 1612 ASSERT_TRUE(AreEqualWithString(events[i].var.pp_var(), message));
1611 } 1613 }
1612 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type); 1614 ASSERT_EQ(WebSocketEvent::EVENT_CLOSE, events[last_event].event_type);
1613 ASSERT_TRUE(events[last_event].was_clean); 1615 ASSERT_TRUE(events[last_event].was_clean);
1614 1616
1615 PASS(); 1617 PASS();
1616 } 1618 }
OLDNEW
« no previous file with comments | « ppapi/tests/test_url_request.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698