| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 TestTimeouts::tiny_timeout(), | 192 TestTimeouts::tiny_timeout(), |
| 193 base::Bind(&GCMConnectionHandlerImplTest::ReadContinuation, | 193 base::Bind(&GCMConnectionHandlerImplTest::ReadContinuation, |
| 194 base::Unretained(this), | 194 base::Unretained(this), |
| 195 dst_proto), | 195 dst_proto), |
| 196 base::Bind(&GCMConnectionHandlerImplTest::WriteContinuation, | 196 base::Bind(&GCMConnectionHandlerImplTest::WriteContinuation, |
| 197 base::Unretained(this)), | 197 base::Unretained(this)), |
| 198 base::Bind(&GCMConnectionHandlerImplTest::ConnectionContinuation, | 198 base::Bind(&GCMConnectionHandlerImplTest::ConnectionContinuation, |
| 199 base::Unretained(this)))); | 199 base::Unretained(this)))); |
| 200 EXPECT_FALSE(connection_handler()->CanSendMessage()); | 200 EXPECT_FALSE(connection_handler()->CanSendMessage()); |
| 201 connection_handler_->Init(*BuildLoginRequest(kAuthId, kAuthToken), | 201 connection_handler_->Init(*BuildLoginRequest(kAuthId, kAuthToken), |
| 202 socket_.Pass()); | 202 socket_.get()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 void GCMConnectionHandlerImplTest::ReadContinuation( | 205 void GCMConnectionHandlerImplTest::ReadContinuation( |
| 206 ScopedMessage* dst_proto, | 206 ScopedMessage* dst_proto, |
| 207 ScopedMessage new_proto) { | 207 ScopedMessage new_proto) { |
| 208 *dst_proto = new_proto.Pass(); | 208 *dst_proto = new_proto.Pass(); |
| 209 run_loop_->Quit(); | 209 run_loop_->Quit(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void GCMConnectionHandlerImplTest::WaitForMessage() { | 212 void GCMConnectionHandlerImplTest::WaitForMessage() { |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 data_message.set_category(kDataMsgCategory); | 619 data_message.set_category(kDataMsgCategory); |
| 620 connection_handler()->SendMessage(data_message); | 620 connection_handler()->SendMessage(data_message); |
| 621 EXPECT_FALSE(connection_handler()->CanSendMessage()); | 621 EXPECT_FALSE(connection_handler()->CanSendMessage()); |
| 622 WaitForMessage(); // The message send. Should result in an error | 622 WaitForMessage(); // The message send. Should result in an error |
| 623 EXPECT_FALSE(connection_handler()->CanSendMessage()); | 623 EXPECT_FALSE(connection_handler()->CanSendMessage()); |
| 624 EXPECT_EQ(net::ERR_CONNECTION_CLOSED, last_error()); | 624 EXPECT_EQ(net::ERR_CONNECTION_CLOSED, last_error()); |
| 625 } | 625 } |
| 626 | 626 |
| 627 } // namespace | 627 } // namespace |
| 628 } // namespace gcm | 628 } // namespace gcm |
| OLD | NEW |