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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 TestOldCompletionCallback read_callback_; | 44 TestOldCompletionCallback read_callback_; |
45 TestOldCompletionCallback write_callback_; | 45 TestOldCompletionCallback write_callback_; |
46 StreamSocket* sock_; | 46 StreamSocket* sock_; |
47 scoped_refptr<DeterministicSocketData> data_; | 47 scoped_refptr<DeterministicSocketData> data_; |
48 | 48 |
49 private: | 49 private: |
50 scoped_refptr<IOBuffer> read_buf_; | 50 scoped_refptr<IOBuffer> read_buf_; |
51 MockConnect connect_data_; | 51 MockConnect connect_data_; |
52 | 52 |
53 GURL url_; | |
54 HostPortPair endpoint_; | 53 HostPortPair endpoint_; |
55 scoped_refptr<TransportSocketParams> tcp_params_; | 54 scoped_refptr<TransportSocketParams> tcp_params_; |
56 ClientSocketPoolHistograms histograms_; | 55 ClientSocketPoolHistograms histograms_; |
57 DeterministicMockClientSocketFactory socket_factory_; | 56 DeterministicMockClientSocketFactory socket_factory_; |
58 MockTransportClientSocketPool socket_pool_; | 57 MockTransportClientSocketPool socket_pool_; |
59 ClientSocketHandle connection_; | 58 ClientSocketHandle connection_; |
60 | 59 |
61 DISALLOW_COPY_AND_ASSIGN(DeterministicSocketDataTest); | 60 DISALLOW_COPY_AND_ASSIGN(DeterministicSocketDataTest); |
62 }; | 61 }; |
63 | 62 |
64 DeterministicSocketDataTest::DeterministicSocketDataTest() | 63 DeterministicSocketDataTest::DeterministicSocketDataTest() |
65 : read_callback_(), | 64 : read_callback_(), |
66 write_callback_(), | 65 write_callback_(), |
67 sock_(NULL), | 66 sock_(NULL), |
68 data_(NULL), | 67 data_(NULL), |
69 read_buf_(NULL), | 68 read_buf_(NULL), |
70 connect_data_(false, OK), | 69 connect_data_(false, OK), |
71 url_("https://www.google.com"), | |
72 endpoint_("www.google.com", 443), | 70 endpoint_("www.google.com", 443), |
73 tcp_params_(new TransportSocketParams(endpoint_, | 71 tcp_params_(new TransportSocketParams(endpoint_, |
74 LOWEST, | 72 LOWEST, |
75 url_, | |
76 false, | 73 false, |
77 false)), | 74 false)), |
78 histograms_(""), | 75 histograms_(""), |
79 socket_pool_(10, 10, &histograms_, &socket_factory_) { | 76 socket_pool_(10, 10, &histograms_, &socket_factory_) { |
80 } | 77 } |
81 | 78 |
82 void DeterministicSocketDataTest::TearDown() { | 79 void DeterministicSocketDataTest::TearDown() { |
83 // Empty the current queue. | 80 // Empty the current queue. |
84 MessageLoop::current()->RunAllPending(); | 81 MessageLoop::current()->RunAllPending(); |
85 PlatformTest::TearDown(); | 82 PlatformTest::TearDown(); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // Issue the writes which will complete immediately | 525 // Issue the writes which will complete immediately |
529 data_->StopAfter(1); | 526 data_->StopAfter(1); |
530 AssertSyncWriteEquals(kMsg3, kLen3); | 527 AssertSyncWriteEquals(kMsg3, kLen3); |
531 | 528 |
532 data_->RunFor(1); | 529 data_->RunFor(1); |
533 ASSERT_EQ(kLen2, read_callback_.WaitForResult()); | 530 ASSERT_EQ(kLen2, read_callback_.WaitForResult()); |
534 AssertReadBufferEquals(kMsg2, kLen2); | 531 AssertReadBufferEquals(kMsg2, kLen2); |
535 } | 532 } |
536 | 533 |
537 } // namespace net | 534 } // namespace net |
OLD | NEW |