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 3757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3768 // Read the response without writing a request, so the read will be pending. | 3768 // Read the response without writing a request, so the read will be pending. |
3769 TestCompletionCallback read_callback; | 3769 TestCompletionCallback read_callback; |
3770 scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); | 3770 scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); |
3771 rv = Read(sock_.get(), buf.get(), 4096, read_callback.callback()); | 3771 rv = Read(sock_.get(), buf.get(), 4096, read_callback.callback()); |
3772 EXPECT_EQ(ERR_IO_PENDING, rv); | 3772 EXPECT_EQ(ERR_IO_PENDING, rv); |
3773 | 3773 |
3774 // Dump memory again and check that |buffer_size| contain the read buffer. | 3774 // Dump memory again and check that |buffer_size| contain the read buffer. |
3775 StreamSocket::SocketMemoryStats stats2; | 3775 StreamSocket::SocketMemoryStats stats2; |
3776 sock_->DumpMemoryStats(&stats2); | 3776 sock_->DumpMemoryStats(&stats2); |
3777 | 3777 |
3778 bool buffer_released = false; | |
3779 if (read_if_ready_enabled()) { | 3778 if (read_if_ready_enabled()) { |
3780 // TODO(xunjieli): https://crbug.com/690915. Implement for windows. | |
3781 #if defined(OS_POSIX) | |
3782 buffer_released = true; | |
3783 #endif | |
3784 } | |
3785 if (buffer_released) { | |
3786 EXPECT_EQ(0u, stats2.buffer_size); | 3779 EXPECT_EQ(0u, stats2.buffer_size); |
3787 EXPECT_EQ(stats.cert_size, stats2.total_size); | 3780 EXPECT_EQ(stats.cert_size, stats2.total_size); |
3788 } else { | 3781 } else { |
3789 EXPECT_EQ(17 * 1024u, stats2.buffer_size); | 3782 EXPECT_EQ(17 * 1024u, stats2.buffer_size); |
3790 EXPECT_LT(17 * 1024u, stats2.total_size); | 3783 EXPECT_LT(17 * 1024u, stats2.total_size); |
3791 } | 3784 } |
3792 EXPECT_EQ(1u, stats2.cert_count); | 3785 EXPECT_EQ(1u, stats2.cert_count); |
3793 EXPECT_LT(0u, stats2.cert_size); | 3786 EXPECT_LT(0u, stats2.cert_size); |
3794 } | 3787 } |
3795 | 3788 |
3796 } // namespace net | 3789 } // namespace net |
OLD | NEW |