| 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 "net/socket/socket_test_util.h" | 5 #include "net/socket/socket_test_util.h" |
| 6 | 6 |
| 7 #include "testing/platform_test.h" | 7 #include "testing/platform_test.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 //----------------------------------------------------------------------------- | 10 //----------------------------------------------------------------------------- |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 size_t writes_count) { | 86 size_t writes_count) { |
| 87 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); | 87 data_ = new DeterministicSocketData(reads, reads_count, writes, writes_count); |
| 88 data_->set_connect_data(connect_data_); | 88 data_->set_connect_data(connect_data_); |
| 89 socket_factory_.AddSocketDataProvider(data_.get()); | 89 socket_factory_.AddSocketDataProvider(data_.get()); |
| 90 | 90 |
| 91 // Perform the TCP connect | 91 // Perform the TCP connect |
| 92 EXPECT_EQ(OK, | 92 EXPECT_EQ(OK, |
| 93 connection_.Init(endpoint_.ToString(), | 93 connection_.Init(endpoint_.ToString(), |
| 94 tcp_params_, | 94 tcp_params_, |
| 95 LOWEST, | 95 LOWEST, |
| 96 NULL, | 96 CompletionCallback(), |
| 97 reinterpret_cast<TransportClientSocketPool*>(&socket_pool_), | 97 reinterpret_cast<TransportClientSocketPool*>(&socket_pool_), |
| 98 BoundNetLog())); | 98 BoundNetLog())); |
| 99 sock_ = connection_.socket(); | 99 sock_ = connection_.socket(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void DeterministicSocketDataTest::AssertSyncReadEquals(const char* data, | 102 void DeterministicSocketDataTest::AssertSyncReadEquals(const char* data, |
| 103 int len) { | 103 int len) { |
| 104 // Issue the read, which will complete immediately | 104 // Issue the read, which will complete immediately |
| 105 AssertReadReturns(data, len, len); | 105 AssertReadReturns(data, len, len); |
| 106 AssertReadBufferEquals(data, len); | 106 AssertReadBufferEquals(data, len); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 // Issue the writes which will complete immediately | 523 // Issue the writes which will complete immediately |
| 524 data_->StopAfter(1); | 524 data_->StopAfter(1); |
| 525 AssertSyncWriteEquals(kMsg3, kLen3); | 525 AssertSyncWriteEquals(kMsg3, kLen3); |
| 526 | 526 |
| 527 data_->RunFor(1); | 527 data_->RunFor(1); |
| 528 ASSERT_EQ(kLen2, read_callback_.WaitForResult()); | 528 ASSERT_EQ(kLen2, read_callback_.WaitForResult()); |
| 529 AssertReadBufferEquals(kMsg2, kLen2); | 529 AssertReadBufferEquals(kMsg2, kLen2); |
| 530 } | 530 } |
| 531 | 531 |
| 532 } // namespace net | 532 } // namespace net |
| OLD | NEW |