Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1358)

Side by Side Diff: content/renderer/p2p/p2p_transport_impl_unittest.cc

Issue 7713021: Add SetProperty() in the PPB_Transport_Dev interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/compiler_specific.h" 5 #include "base/compiler_specific.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "content/renderer/p2p/p2p_transport_impl.h" 9 #include "content/renderer/p2p/p2p_transport_impl.h"
10 #include "jingle/glue/fake_network_manager.h" 10 #include "jingle/glue/fake_network_manager.h"
(...skipping 14 matching lines...) Expand all
25 25
26 using webkit_glue::P2PTransport; 26 using webkit_glue::P2PTransport;
27 27
28 namespace { 28 namespace {
29 const char kTestAddress1[] = "192.168.15.12"; 29 const char kTestAddress1[] = "192.168.15.12";
30 const char kTestAddress2[] = "192.168.15.33"; 30 const char kTestAddress2[] = "192.168.15.33";
31 31
32 const char kTransportName1[] = "tr1"; 32 const char kTransportName1[] = "tr1";
33 const char kTransportName2[] = "tr2"; 33 const char kTransportName2[] = "tr2";
34 34
35 const char kTestConfig[] = "";
36
37 // Send 10 packets 10 bytes each. Packets are sent with 10ms delay 35 // Send 10 packets 10 bytes each. Packets are sent with 10ms delay
38 // between packets (about 100 ms for 10 messages). 36 // between packets (about 100 ms for 10 messages).
39 const int kMessageSize = 10; 37 const int kMessageSize = 10;
40 const int kMessages = 10; 38 const int kMessages = 10;
41 const int kUdpWriteDelayMs = 10; 39 const int kUdpWriteDelayMs = 10;
42 const int kTcpDataSize = 10 * 1024; 40 const int kTcpDataSize = 10 * 1024;
43 const int kTcpWriteDelayMs = 1; 41 const int kTcpWriteDelayMs = 1;
44 42
45 class UdpChannelTester : public base::RefCountedThreadSafe<UdpChannelTester> { 43 class UdpChannelTester : public base::RefCountedThreadSafe<UdpChannelTester> {
46 public: 44 public:
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 new jingle_glue::FakeNetworkManager(ip), 341 new jingle_glue::FakeNetworkManager(ip),
344 new jingle_glue::FakeSocketFactory(socket_manager_, ip))); 342 new jingle_glue::FakeSocketFactory(socket_manager_, ip)));
345 343
346 ASSERT_TRUE(net::ParseIPLiteralToNumber(kTestAddress2, &ip)); 344 ASSERT_TRUE(net::ParseIPLiteralToNumber(kTestAddress2, &ip));
347 transport2_.reset(new P2PTransportImpl( 345 transport2_.reset(new P2PTransportImpl(
348 new jingle_glue::FakeNetworkManager(ip), 346 new jingle_glue::FakeNetworkManager(ip),
349 new jingle_glue::FakeSocketFactory(socket_manager_, ip))); 347 new jingle_glue::FakeSocketFactory(socket_manager_, ip)));
350 } 348 }
351 349
352 void Init(P2PTransport::Protocol protocol) { 350 void Init(P2PTransport::Protocol protocol) {
351 P2PTransport::Config config;
353 ASSERT_TRUE(transport1_->Init( 352 ASSERT_TRUE(transport1_->Init(
354 kTransportName1, protocol, kTestConfig, &event_handler1_)); 353 kTransportName1, protocol, config, &event_handler1_));
355 ASSERT_TRUE(transport2_->Init( 354 ASSERT_TRUE(transport2_->Init(
356 kTransportName2, protocol, kTestConfig, &event_handler2_)); 355 kTransportName2, protocol, config, &event_handler2_));
357 } 356 }
358 357
359 MessageLoop message_loop_; 358 MessageLoop message_loop_;
360 359
361 scoped_refptr<jingle_glue::FakeSocketManager> socket_manager_; 360 scoped_refptr<jingle_glue::FakeSocketManager> socket_manager_;
362 scoped_ptr<P2PTransportImpl> transport1_; 361 scoped_ptr<P2PTransportImpl> transport1_;
363 MockP2PEventHandler event_handler1_; 362 MockP2PEventHandler event_handler1_;
364 scoped_ptr<P2PTransportImpl> transport2_; 363 scoped_ptr<P2PTransportImpl> transport2_;
365 MockP2PEventHandler event_handler2_; 364 MockP2PEventHandler event_handler2_;
366 }; 365 };
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 &TcpChannelTester::StartRead)) 475 &TcpChannelTester::StartRead))
477 .RetiresOnSaturation(); 476 .RetiresOnSaturation();
478 477
479 message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), 478 message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(),
480 TestTimeouts::action_max_timeout_ms()); 479 TestTimeouts::action_max_timeout_ms());
481 480
482 channel_tester->Init(); 481 channel_tester->Init();
483 message_loop_.Run(); 482 message_loop_.Run();
484 channel_tester->CheckResults(); 483 channel_tester->CheckResults();
485 } 484 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698