diff options
author | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-05 17:37:04 +0000 |
---|---|---|
committer | rsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-05 17:37:04 +0000 |
commit | 886ae9fb352a5e8c15343294a71e3154895de45e (patch) | |
tree | 7bf877eb28c274ddfdc9fb128f3293e24524cedc /jingle | |
parent | ab877f533b132eaaddd155398c75851776e579a7 (diff) | |
download | chromium_src-886ae9fb352a5e8c15343294a71e3154895de45e.zip chromium_src-886ae9fb352a5e8c15343294a71e3154895de45e.tar.gz chromium_src-886ae9fb352a5e8c15343294a71e3154895de45e.tar.bz2 |
Ensure PseudoTcpAdapterTest.LossyChannel can properly handle packet loss when Connect()'ing
BUG=88418
TEST=none
Review URL: http://codereview.chromium.org/7307006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/glue/pseudotcp_adapter_unittest.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/jingle/glue/pseudotcp_adapter_unittest.cc b/jingle/glue/pseudotcp_adapter_unittest.cc index 7c592085..34f4f65 100644 --- a/jingle/glue/pseudotcp_adapter_unittest.cc +++ b/jingle/glue/pseudotcp_adapter_unittest.cc @@ -276,8 +276,15 @@ TEST_F(PseudoTcpAdapterTest, DataTransfer) { TestCompletionCallback host_connect_cb; TestCompletionCallback client_connect_cb; - host_pseudotcp_->Connect(&host_connect_cb); - client_pseudotcp_->Connect(&client_connect_cb); + int rv1 = host_pseudotcp_->Connect(&host_connect_cb); + int rv2 = client_pseudotcp_->Connect(&client_connect_cb); + + if (rv1 == net::ERR_IO_PENDING) + rv1 = host_connect_cb.WaitForResult(); + if (rv2 == net::ERR_IO_PENDING) + rv2 = client_connect_cb.WaitForResult(); + ASSERT_EQ(net::OK, rv1); + ASSERT_EQ(net::OK, rv2); scoped_refptr<TCPChannelTester> tester = new TCPChannelTester(&message_loop_, host_pseudotcp_.get(), @@ -295,8 +302,15 @@ TEST_F(PseudoTcpAdapterTest, LossyChannel) { TestCompletionCallback host_connect_cb; TestCompletionCallback client_connect_cb; - host_pseudotcp_->Connect(&host_connect_cb); - client_pseudotcp_->Connect(&client_connect_cb); + int rv1 = host_pseudotcp_->Connect(&host_connect_cb); + int rv2 = client_pseudotcp_->Connect(&client_connect_cb); + + if (rv1 == net::ERR_IO_PENDING) + rv1 = host_connect_cb.WaitForResult(); + if (rv2 == net::ERR_IO_PENDING) + rv2 = client_connect_cb.WaitForResult(); + ASSERT_EQ(net::OK, rv1); + ASSERT_EQ(net::OK, rv2); scoped_refptr<TCPChannelTester> tester = new TCPChannelTester(&message_loop_, host_pseudotcp_.get(), |