OLD | NEW |
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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 net::ERR_IO_PENDING) { | 168 net::ERR_IO_PENDING) { |
169 run_loop.Run(); | 169 run_loop.Run(); |
170 } | 170 } |
171 if (input_stream()->GetState() == SocketInputStream::CLOSED) | 171 if (input_stream()->GetState() == SocketInputStream::CLOSED) |
172 return; | 172 return; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void GCMSocketStreamTest::OpenConnection() { | 176 void GCMSocketStreamTest::OpenConnection() { |
177 socket_ = socket_factory_.CreateTransportClientSocket( | 177 socket_ = socket_factory_.CreateTransportClientSocket( |
178 address_list_, NULL, net::NetLog::Source()); | 178 address_list_, NULL, NULL, net::NetLog::Source()); |
179 socket_->Connect( | 179 socket_->Connect( |
180 base::Bind(&GCMSocketStreamTest::ConnectCallback, | 180 base::Bind(&GCMSocketStreamTest::ConnectCallback, |
181 base::Unretained(this))); | 181 base::Unretained(this))); |
182 PumpLoop(); | 182 PumpLoop(); |
183 } | 183 } |
184 | 184 |
185 void GCMSocketStreamTest::ConnectCallback(int result) {} | 185 void GCMSocketStreamTest::ConnectCallback(int result) {} |
186 | 186 |
187 void GCMSocketStreamTest::ResetInputStream() { | 187 void GCMSocketStreamTest::ResetInputStream() { |
188 DCHECK(socket_.get()); | 188 DCHECK(socket_.get()); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 TEST_F(GCMSocketStreamTest, WriteDisconnected) { | 391 TEST_F(GCMSocketStreamTest, WriteDisconnected) { |
392 BuildSocket(ReadList(), WriteList()); | 392 BuildSocket(ReadList(), WriteList()); |
393 socket()->Disconnect(); | 393 socket()->Disconnect(); |
394 DoOutputStreamWrite(base::StringPiece(kWriteData, kWriteDataSize)); | 394 DoOutputStreamWrite(base::StringPiece(kWriteData, kWriteDataSize)); |
395 ASSERT_EQ(SocketOutputStream::CLOSED, output_stream()->GetState()); | 395 ASSERT_EQ(SocketOutputStream::CLOSED, output_stream()->GetState()); |
396 ASSERT_EQ(net::ERR_CONNECTION_CLOSED, output_stream()->last_error()); | 396 ASSERT_EQ(net::ERR_CONNECTION_CLOSED, output_stream()->last_error()); |
397 } | 397 } |
398 | 398 |
399 } // namespace | 399 } // namespace |
400 } // namespace gcm | 400 } // namespace gcm |
OLD | NEW |