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