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

Side by Side Diff: mojo/services/network/http_server_apptest.cc

Issue 1543603002: Switch to standard integer types in mojo/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h>
6 #include <stdint.h>
7
5 #include <utility> 8 #include <utility>
6 9
7 #include "base/logging.h" 10 #include "base/logging.h"
8 #include "base/macros.h" 11 #include "base/macros.h"
9 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
10 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
12 #include "base/run_loop.h" 15 #include "base/run_loop.h"
13 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 252 }
250 253
251 bool IsCompleteResponse(const std::string& response) { 254 bool IsCompleteResponse(const std::string& response) {
252 // Check end of headers first. 255 // Check end of headers first.
253 int end_of_headers = 256 int end_of_headers =
254 net::HttpUtil::LocateEndOfHeaders(response.data(), response.size()); 257 net::HttpUtil::LocateEndOfHeaders(response.data(), response.size());
255 if (end_of_headers < 0) 258 if (end_of_headers < 0)
256 return false; 259 return false;
257 260
258 // Return true if response has data equal to or more than content length. 261 // Return true if response has data equal to or more than content length.
259 int64 body_size = static_cast<int64>(response.size()) - end_of_headers; 262 int64_t body_size = static_cast<int64_t>(response.size()) - end_of_headers;
260 DCHECK_LE(0, body_size); 263 DCHECK_LE(0, body_size);
261 scoped_refptr<net::HttpResponseHeaders> headers( 264 scoped_refptr<net::HttpResponseHeaders> headers(
262 new net::HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders( 265 new net::HttpResponseHeaders(net::HttpUtil::AssembleRawHeaders(
263 response.data(), end_of_headers))); 266 response.data(), end_of_headers)));
264 return body_size >= headers->GetContentLength(); 267 return body_size >= headers->GetContentLength();
265 } 268 }
266 269
267 scoped_refptr<net::IOBufferWithSize> read_buffer_; 270 scoped_refptr<net::IOBufferWithSize> read_buffer_;
268 scoped_refptr<net::DrainableIOBuffer> write_buffer_; 271 scoped_refptr<net::DrainableIOBuffer> write_buffer_;
269 scoped_ptr<net::TCPClientSocket> socket_; 272 scoped_ptr<net::TCPClientSocket> socket_;
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 691
689 socket_1.Send("How do"); 692 socket_1.Send("How do");
690 socket_1.Send("you do?"); 693 socket_1.Send("you do?");
691 694
692 socket_0.WaitForMessage(2); 695 socket_0.WaitForMessage(2);
693 EXPECT_EQ("How do", socket_0.received_messages()[0]); 696 EXPECT_EQ("How do", socket_0.received_messages()[0]);
694 EXPECT_EQ("you do?", socket_0.received_messages()[1]); 697 EXPECT_EQ("you do?", socket_0.received_messages()[1]);
695 } 698 }
696 699
697 } // namespace mojo 700 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/network/http_connection_impl.cc ('k') | mojo/services/network/mojo_persistent_cookie_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698