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

Side by Side Diff: google_apis/gcm/base/socket_stream_unittest.cc

Issue 1548673002: Switch to standard integer types in google_apis/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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 | « google_apis/gcm/base/socket_stream.cc ('k') | google_apis/gcm/engine/account_mapping.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "google_apis/gcm/base/socket_stream.h" 5 #include "google_apis/gcm/base/socket_stream.h"
6 6
7 #include "base/basictypes.h" 7 #include <stdint.h>
8
8 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 12 #include "base/run_loop.h"
11 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
12 #include "net/socket/socket_test_util.h" 14 #include "net/socket/socket_test_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 16
15 namespace gcm { 17 namespace gcm {
16 namespace { 18 namespace {
17 19
18 typedef std::vector<net::MockRead> ReadList; 20 typedef std::vector<net::MockRead> ReadList;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 const void* buffer = NULL; 108 const void* buffer = NULL;
107 int size = 0; 109 int size = 0;
108 110
109 do { 111 do {
110 DCHECK(socket_input_stream_->GetState() == SocketInputStream::EMPTY || 112 DCHECK(socket_input_stream_->GetState() == SocketInputStream::EMPTY ||
111 socket_input_stream_->GetState() == SocketInputStream::READY); 113 socket_input_stream_->GetState() == SocketInputStream::READY);
112 if (!socket_input_stream_->Next(&buffer, &size)) 114 if (!socket_input_stream_->Next(&buffer, &size))
113 break; 115 break;
114 total_bytes_read += size; 116 total_bytes_read += size;
115 if (initial_buffer) { // Verify the buffer doesn't skip data. 117 if (initial_buffer) { // Verify the buffer doesn't skip data.
116 EXPECT_EQ(static_cast<const uint8*>(initial_buffer) + total_bytes_read, 118 EXPECT_EQ(static_cast<const uint8_t*>(initial_buffer) + total_bytes_read,
117 static_cast<const uint8*>(buffer) + size); 119 static_cast<const uint8_t*>(buffer) + size);
118 } else { 120 } else {
119 initial_buffer = buffer; 121 initial_buffer = buffer;
120 } 122 }
121 } while (total_bytes_read < bytes); 123 } while (total_bytes_read < bytes);
122 124
123 if (total_bytes_read > bytes) { 125 if (total_bytes_read > bytes) {
124 socket_input_stream_->BackUp(total_bytes_read - bytes); 126 socket_input_stream_->BackUp(total_bytes_read - bytes);
125 total_bytes_read = bytes; 127 total_bytes_read = bytes;
126 } 128 }
127 129
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 TEST_F(GCMSocketStreamTest, WriteDisconnected) { 391 TEST_F(GCMSocketStreamTest, WriteDisconnected) {
390 BuildSocket(ReadList(), WriteList()); 392 BuildSocket(ReadList(), WriteList());
391 socket()->Disconnect(); 393 socket()->Disconnect();
392 DoOutputStreamWrite(base::StringPiece(kWriteData, kWriteDataSize)); 394 DoOutputStreamWrite(base::StringPiece(kWriteData, kWriteDataSize));
393 ASSERT_EQ(SocketOutputStream::CLOSED, output_stream()->GetState()); 395 ASSERT_EQ(SocketOutputStream::CLOSED, output_stream()->GetState());
394 ASSERT_EQ(net::ERR_CONNECTION_CLOSED, output_stream()->last_error()); 396 ASSERT_EQ(net::ERR_CONNECTION_CLOSED, output_stream()->last_error());
395 } 397 }
396 398
397 } // namespace 399 } // namespace
398 } // namespace gcm 400 } // namespace gcm
OLDNEW
« no previous file with comments | « google_apis/gcm/base/socket_stream.cc ('k') | google_apis/gcm/engine/account_mapping.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698