OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/p2p/p2p_transport_impl.h" |
| 6 |
5 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
6 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
7 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
8 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
9 #include "content/renderer/p2p/p2p_transport_impl.h" | |
10 #include "jingle/glue/fake_network_manager.h" | 11 #include "jingle/glue/fake_network_manager.h" |
11 #include "jingle/glue/fake_socket_factory.h" | 12 #include "jingle/glue/fake_socket_factory.h" |
12 #include "jingle/glue/thread_wrapper.h" | 13 #include "jingle/glue/thread_wrapper.h" |
13 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
14 #include "net/base/io_buffer.h" | 15 #include "net/base/io_buffer.h" |
15 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
16 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
17 #include "net/socket/socket.h" | 18 #include "net/socket/socket.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 std::vector<char> received_data_; | 317 std::vector<char> received_data_; |
317 | 318 |
318 net::CompletionCallbackImpl<TcpChannelTester> write_cb_; | 319 net::CompletionCallbackImpl<TcpChannelTester> write_cb_; |
319 net::CompletionCallbackImpl<TcpChannelTester> read_cb_; | 320 net::CompletionCallbackImpl<TcpChannelTester> read_cb_; |
320 int write_errors_; | 321 int write_errors_; |
321 int read_errors_; | 322 int read_errors_; |
322 }; | 323 }; |
323 | 324 |
324 } // namespace | 325 } // namespace |
325 | 326 |
| 327 namespace content { |
| 328 |
326 class MockP2PEventHandler : public P2PTransport::EventHandler { | 329 class MockP2PEventHandler : public P2PTransport::EventHandler { |
327 public: | 330 public: |
328 MOCK_METHOD1(OnCandidateReady, void(const std::string& address)); | 331 MOCK_METHOD1(OnCandidateReady, void(const std::string& address)); |
329 MOCK_METHOD1(OnStateChange, void(P2PTransport::State state)); | 332 MOCK_METHOD1(OnStateChange, void(P2PTransport::State state)); |
330 MOCK_METHOD1(OnError, void(int error)); | 333 MOCK_METHOD1(OnError, void(int error)); |
331 }; | 334 }; |
332 | 335 |
333 class P2PTransportImplTest : public testing::Test { | 336 class P2PTransportImplTest : public testing::Test { |
334 public: | 337 public: |
335 | 338 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 &TcpChannelTester::StartRead)) | 479 &TcpChannelTester::StartRead)) |
477 .RetiresOnSaturation(); | 480 .RetiresOnSaturation(); |
478 | 481 |
479 message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), | 482 message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), |
480 TestTimeouts::action_max_timeout_ms()); | 483 TestTimeouts::action_max_timeout_ms()); |
481 | 484 |
482 channel_tester->Init(); | 485 channel_tester->Init(); |
483 message_loop_.Run(); | 486 message_loop_.Run(); |
484 channel_tester->CheckResults(); | 487 channel_tester->CheckResults(); |
485 } | 488 } |
| 489 |
| 490 } // namespace content |
OLD | NEW |