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 "content/child/shared_memory_received_data_factory.h" | 5 #include "content/child/shared_memory_received_data_factory.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <tuple> |
8 | 9 |
9 #include "base/tuple.h" | |
10 #include "content/common/resource_messages.h" | 10 #include "content/common/resource_messages.h" |
11 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
12 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.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 namespace content { | 16 namespace content { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 using ::testing::_; | 20 using ::testing::_; |
21 using ::testing::InSequence; | 21 using ::testing::InSequence; |
22 using ::testing::MockFunction; | 22 using ::testing::MockFunction; |
23 using ::testing::Return; | 23 using ::testing::Return; |
24 using ::testing::StrictMock; | 24 using ::testing::StrictMock; |
25 | 25 |
26 using Checkpoint = StrictMock<MockFunction<void(int)>>; | 26 using Checkpoint = StrictMock<MockFunction<void(int)>>; |
27 using ReceivedData = RequestPeer::ReceivedData; | 27 using ReceivedData = RequestPeer::ReceivedData; |
28 | 28 |
29 class MockSender : public IPC::Sender { | 29 class MockSender : public IPC::Sender { |
30 public: | 30 public: |
31 bool Send(IPC::Message* message) override { | 31 bool Send(IPC::Message* message) override { |
32 bool result = false; | 32 bool result = false; |
33 if (message->type() == ResourceHostMsg_DataReceived_ACK::ID) { | 33 if (message->type() == ResourceHostMsg_DataReceived_ACK::ID) { |
34 base::Tuple<int> args; | 34 std::tuple<int> args; |
35 ResourceHostMsg_DataReceived_ACK::Read(message, &args); | 35 ResourceHostMsg_DataReceived_ACK::Read(message, &args); |
36 result = SendAck(base::get<0>(args)); | 36 result = SendAck(std::get<0>(args)); |
37 } else { | 37 } else { |
38 result = SendOtherwise(message); | 38 result = SendOtherwise(message); |
39 } | 39 } |
40 delete message; | 40 delete message; |
41 return result; | 41 return result; |
42 } | 42 } |
43 MOCK_METHOD1(SendAck, bool(int)); | 43 MOCK_METHOD1(SendAck, bool(int)); |
44 MOCK_METHOD1(SendOtherwise, bool(IPC::Message*)); | 44 MOCK_METHOD1(SendOtherwise, bool(IPC::Message*)); |
45 }; | 45 }; |
46 | 46 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 checkpoint.Call(2); | 217 checkpoint.Call(2); |
218 factory_->Stop(); | 218 factory_->Stop(); |
219 data5.reset(); | 219 data5.reset(); |
220 data4.reset(); | 220 data4.reset(); |
221 checkpoint.Call(3); | 221 checkpoint.Call(3); |
222 } | 222 } |
223 | 223 |
224 } // namespace | 224 } // namespace |
225 | 225 |
226 } // namespace content | 226 } // namespace content |
OLD | NEW |