Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: net/http/http_network_transaction_unittest.cc

Issue 21501: If an idle socket has received data unexpectedly, we... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Final upload before checkin. Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/tcp_client_socket_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « net/base/tcp_client_socket_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698