OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl_client_socket.h" | 5 #include "net/socket/ssl_client_socket.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3772 // Read the response without writing a request, so the read will be pending. | 3772 // Read the response without writing a request, so the read will be pending. |
3773 TestCompletionCallback read_callback; | 3773 TestCompletionCallback read_callback; |
3774 scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); | 3774 scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); |
3775 rv = Read(sock_.get(), buf.get(), 4096, read_callback.callback()); | 3775 rv = Read(sock_.get(), buf.get(), 4096, read_callback.callback()); |
3776 EXPECT_EQ(ERR_IO_PENDING, rv); | 3776 EXPECT_EQ(ERR_IO_PENDING, rv); |
3777 | 3777 |
3778 // Dump memory again and check that |buffer_size| contain the read buffer. | 3778 // Dump memory again and check that |buffer_size| contain the read buffer. |
3779 StreamSocket::SocketMemoryStats stats2; | 3779 StreamSocket::SocketMemoryStats stats2; |
3780 sock_->DumpMemoryStats(&stats2); | 3780 sock_->DumpMemoryStats(&stats2); |
3781 | 3781 |
3782 bool buffer_released = false; | |
3783 if (read_if_ready_enabled()) { | 3782 if (read_if_ready_enabled()) { |
3784 // TODO(xunjieli): https://crbug.com/690915. Implement for windows. | |
3785 #if defined(OS_POSIX) | |
3786 buffer_released = true; | |
3787 #endif | |
3788 } | |
3789 if (buffer_released) { | |
3790 EXPECT_EQ(0u, stats2.buffer_size); | 3783 EXPECT_EQ(0u, stats2.buffer_size); |
3791 EXPECT_EQ(stats.cert_size, stats2.total_size); | 3784 EXPECT_EQ(stats.cert_size, stats2.total_size); |
3792 } else { | 3785 } else { |
3793 EXPECT_EQ(17 * 1024u, stats2.buffer_size); | 3786 EXPECT_EQ(17 * 1024u, stats2.buffer_size); |
3794 EXPECT_LT(17 * 1024u, stats2.total_size); | 3787 EXPECT_LT(17 * 1024u, stats2.total_size); |
3795 } | 3788 } |
3796 EXPECT_EQ(1u, stats2.cert_count); | 3789 EXPECT_EQ(1u, stats2.cert_count); |
3797 EXPECT_LT(0u, stats2.cert_size); | 3790 EXPECT_LT(0u, stats2.cert_size); |
3798 } | 3791 } |
3799 | 3792 |
3800 } // namespace net | 3793 } // namespace net |
OLD | NEW |