| 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/engine/connection_handler_impl.h" | 5 #include "google_apis/gcm/engine/connection_handler_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 const WriteList& write_list) { | 203 const WriteList& write_list) { |
| 204 mock_reads_ = read_list; | 204 mock_reads_ = read_list; |
| 205 mock_writes_ = write_list; | 205 mock_writes_ = write_list; |
| 206 data_provider_.reset( | 206 data_provider_.reset( |
| 207 new net::StaticSocketDataProvider( | 207 new net::StaticSocketDataProvider( |
| 208 &(mock_reads_[0]), mock_reads_.size(), | 208 &(mock_reads_[0]), mock_reads_.size(), |
| 209 &(mock_writes_[0]), mock_writes_.size())); | 209 &(mock_writes_[0]), mock_writes_.size())); |
| 210 socket_factory_.AddSocketDataProvider(data_provider_.get()); | 210 socket_factory_.AddSocketDataProvider(data_provider_.get()); |
| 211 | 211 |
| 212 socket_ = socket_factory_.CreateTransportClientSocket( | 212 socket_ = socket_factory_.CreateTransportClientSocket( |
| 213 address_list_, NULL, net::NetLog::Source()); | 213 address_list_, NULL, NULL, net::NetLog::Source()); |
| 214 socket_->Connect(net::CompletionCallback()); | 214 socket_->Connect(net::CompletionCallback()); |
| 215 | 215 |
| 216 run_loop_.reset(new base::RunLoop()); | 216 run_loop_.reset(new base::RunLoop()); |
| 217 PumpLoop(); | 217 PumpLoop(); |
| 218 | 218 |
| 219 DCHECK(socket_->IsConnected()); | 219 DCHECK(socket_->IsConnected()); |
| 220 return socket_.get(); | 220 return socket_.get(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void GCMConnectionHandlerImplTest::PumpLoop() { | 223 void GCMConnectionHandlerImplTest::PumpLoop() { |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 WaitForMessage(); // The login send. | 903 WaitForMessage(); // The login send. |
| 904 WaitForMessage(); // The login response. | 904 WaitForMessage(); // The login response. |
| 905 received_message.reset(); | 905 received_message.reset(); |
| 906 WaitForMessage(); // The invalid message. | 906 WaitForMessage(); // The invalid message. |
| 907 EXPECT_FALSE(received_message.get()); | 907 EXPECT_FALSE(received_message.get()); |
| 908 EXPECT_EQ(net::ERR_FAILED, last_error()); | 908 EXPECT_EQ(net::ERR_FAILED, last_error()); |
| 909 } | 909 } |
| 910 | 910 |
| 911 } // namespace | 911 } // namespace |
| 912 } // namespace gcm | 912 } // namespace gcm |
| OLD | NEW |