OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "blimp/net/blimp_message_checkpointer.h" | 5 #include "blimp/net/blimp_message_checkpointer.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/test/test_mock_time_task_runner.h" | 8 #include "base/test/test_mock_time_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "blimp/net/test_common.h" | 10 #include "blimp/net/test_common.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/base/test_completion_callback.h" | 12 #include "net/base/test_completion_callback.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using testing::_; | 16 using testing::_; |
17 using testing::InvokeArgument; | |
18 using testing::Return; | |
19 using testing::SaveArg; | 17 using testing::SaveArg; |
20 | 18 |
21 namespace blimp { | 19 namespace blimp { |
22 | 20 |
23 static scoped_ptr<BlimpMessage> CreateExpectedAckMessage(int64 id) { | 21 static scoped_ptr<BlimpMessage> CreateExpectedAckMessage(int64 id) { |
24 scoped_ptr<BlimpMessage> message = make_scoped_ptr(new BlimpMessage); | 22 scoped_ptr<BlimpMessage> message = make_scoped_ptr(new BlimpMessage); |
25 message->set_type(BlimpMessage::PROTOCOL_CONTROL); | 23 message->set_type(BlimpMessage::PROTOCOL_CONTROL); |
26 ProtocolControlMessage* protocol_control = | 24 ProtocolControlMessage* protocol_control = |
27 message->mutable_protocol_control(); | 25 message->mutable_protocol_control(); |
28 protocol_control->set_type(ProtocolControlMessage::CHECKPOINT_ACK); | 26 protocol_control->set_type(ProtocolControlMessage::CHECKPOINT_ACK); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 captured_cb_.Run(net::OK); | 146 captured_cb_.Run(net::OK); |
149 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); | 147 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); |
150 | 148 |
151 // And do it again to verify we get a fresh ACK. | 149 // And do it again to verify we get a fresh ACK. |
152 SimulateIncomingMessage(); | 150 SimulateIncomingMessage(); |
153 captured_cb_.Run(net::OK); | 151 captured_cb_.Run(net::OK); |
154 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); | 152 runner_->FastForwardBy(base::TimeDelta::FromSeconds(2)); |
155 } | 153 } |
156 | 154 |
157 } // namespace blimp | 155 } // namespace blimp |
OLD | NEW |