OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <math.h> // ceil | 5 #include <math.h> // ceil |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "net/base/client_socket_factory.h" | 8 #include "net/base/client_socket_factory.h" |
9 #include "net/base/test_completion_callback.h" | 9 #include "net/base/test_completion_callback.h" |
10 #include "net/base/upload_data.h" | 10 #include "net/base/upload_data.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 NOTREACHED(); | 102 NOTREACHED(); |
103 return net::ERR_FAILED; | 103 return net::ERR_FAILED; |
104 } | 104 } |
105 virtual void Disconnect() { | 105 virtual void Disconnect() { |
106 connected_ = false; | 106 connected_ = false; |
107 callback_ = NULL; | 107 callback_ = NULL; |
108 } | 108 } |
109 virtual bool IsConnected() const { | 109 virtual bool IsConnected() const { |
110 return connected_; | 110 return connected_; |
111 } | 111 } |
| 112 virtual bool IsConnectedAndIdle() const { |
| 113 return connected_; |
| 114 } |
112 // Socket methods: | 115 // Socket methods: |
113 virtual int Read(char* buf, int buf_len, net::CompletionCallback* callback) { | 116 virtual int Read(char* buf, int buf_len, net::CompletionCallback* callback) { |
114 DCHECK(!callback_); | 117 DCHECK(!callback_); |
115 MockRead& r = data_->reads[read_index_]; | 118 MockRead& r = data_->reads[read_index_]; |
116 int result = r.result; | 119 int result = r.result; |
117 if (r.data) { | 120 if (r.data) { |
118 if (r.data_len - read_offset_ > 0) { | 121 if (r.data_len - read_offset_ > 0) { |
119 result = std::min(buf_len, r.data_len - read_offset_); | 122 result = std::min(buf_len, r.data_len - read_offset_); |
120 memcpy(buf, r.data + read_offset_, result); | 123 memcpy(buf, r.data + read_offset_, result); |
121 read_offset_ += result; | 124 read_offset_ += result; |
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1864 | 1867 |
1865 rv = callback2.WaitForResult(); | 1868 rv = callback2.WaitForResult(); |
1866 EXPECT_EQ(net::OK, rv); | 1869 EXPECT_EQ(net::OK, rv); |
1867 | 1870 |
1868 response = trans->GetResponseInfo(); | 1871 response = trans->GetResponseInfo(); |
1869 EXPECT_FALSE(response == NULL); | 1872 EXPECT_FALSE(response == NULL); |
1870 EXPECT_TRUE(response->auth_challenge.get() == NULL); | 1873 EXPECT_TRUE(response->auth_challenge.get() == NULL); |
1871 EXPECT_EQ(100, response->headers->GetContentLength()); | 1874 EXPECT_EQ(100, response->headers->GetContentLength()); |
1872 } | 1875 } |
1873 } | 1876 } |
OLD | NEW |