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 | |
9 #include <string> | 8 #include <string> |
| 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
16 #include "google/protobuf/io/coded_stream.h" | 16 #include "google/protobuf/io/coded_stream.h" |
17 #include "google/protobuf/io/zero_copy_stream_impl_lite.h" | 17 #include "google/protobuf/io/zero_copy_stream_impl_lite.h" |
18 #include "google/protobuf/wire_format_lite.h" | 18 #include "google/protobuf/wire_format_lite.h" |
19 #include "google_apis/gcm/base/mcs_util.h" | 19 #include "google_apis/gcm/base/mcs_util.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 base::Unretained(this)))); | 237 base::Unretained(this)))); |
238 EXPECT_FALSE(connection_handler()->CanSendMessage()); | 238 EXPECT_FALSE(connection_handler()->CanSendMessage()); |
239 connection_handler_->Init( | 239 connection_handler_->Init( |
240 *BuildLoginRequest(kAuthId, kAuthToken, ""), | 240 *BuildLoginRequest(kAuthId, kAuthToken, ""), |
241 socket_.get()); | 241 socket_.get()); |
242 } | 242 } |
243 | 243 |
244 void GCMConnectionHandlerImplTest::ReadContinuation( | 244 void GCMConnectionHandlerImplTest::ReadContinuation( |
245 ScopedMessage* dst_proto, | 245 ScopedMessage* dst_proto, |
246 ScopedMessage new_proto) { | 246 ScopedMessage new_proto) { |
247 *dst_proto = new_proto.Pass(); | 247 *dst_proto = std::move(new_proto); |
248 run_loop_->Quit(); | 248 run_loop_->Quit(); |
249 } | 249 } |
250 | 250 |
251 void GCMConnectionHandlerImplTest::WaitForMessage() { | 251 void GCMConnectionHandlerImplTest::WaitForMessage() { |
252 run_loop_->Run(); | 252 run_loop_->Run(); |
253 run_loop_.reset(new base::RunLoop()); | 253 run_loop_.reset(new base::RunLoop()); |
254 } | 254 } |
255 | 255 |
256 void GCMConnectionHandlerImplTest::WriteContinuation() { | 256 void GCMConnectionHandlerImplTest::WriteContinuation() { |
257 run_loop_->Quit(); | 257 run_loop_->Quit(); |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 WaitForMessage(); // The login send. | 902 WaitForMessage(); // The login send. |
903 WaitForMessage(); // The login response. | 903 WaitForMessage(); // The login response. |
904 received_message.reset(); | 904 received_message.reset(); |
905 WaitForMessage(); // The invalid message. | 905 WaitForMessage(); // The invalid message. |
906 EXPECT_FALSE(received_message.get()); | 906 EXPECT_FALSE(received_message.get()); |
907 EXPECT_EQ(net::ERR_FAILED, last_error()); | 907 EXPECT_EQ(net::ERR_FAILED, last_error()); |
908 } | 908 } |
909 | 909 |
910 } // namespace | 910 } // namespace |
911 } // namespace gcm | 911 } // namespace gcm |
OLD | NEW |