Chromium Code Reviews| 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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 4207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4218 | 4218 |
| 4219 const HttpResponseInfo* response = trans->GetResponseInfo(); | 4219 const HttpResponseInfo* response = trans->GetResponseInfo(); |
| 4220 EXPECT_TRUE(response->headers.get() != NULL); | 4220 EXPECT_TRUE(response->headers.get() != NULL); |
| 4221 EXPECT_TRUE(response->was_fetched_via_spdy); | 4221 EXPECT_TRUE(response->was_fetched_via_spdy); |
| 4222 out.status_line = response->headers->GetStatusLine(); | 4222 out.status_line = response->headers->GetStatusLine(); |
| 4223 out.response_info = *response; // Make a copy so we can verify. | 4223 out.response_info = *response; // Make a copy so we can verify. |
| 4224 | 4224 |
| 4225 // Read Data | 4225 // Read Data |
| 4226 TestCompletionCallback read_callback; | 4226 TestCompletionCallback read_callback; |
| 4227 | 4227 |
| 4228 do { | 4228 const int kReadSize = 256; |
| 4229 const int kReadSize = 256; | 4229 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kReadSize)); |
| 4230 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kReadSize)); | 4230 rv = trans->Read(buf.get(), kReadSize, read_callback.callback()); |
| 4231 rv = trans->Read(buf.get(), kReadSize, read_callback.callback()); | 4231 if (rv != net::ERR_IO_PENDING) { |
| 4232 if (rv == net::ERR_IO_PENDING) { | |
| 4233 // Complete the read now, which causes buffering to start. | |
| 4234 data.CompleteRead(); | |
| 4235 // Destroy the transaction, causing the stream to get cancelled | |
| 4236 // and orphaning the buffered IO task. | |
| 4237 helper.ResetTrans(); | |
| 4238 break; | |
| 4239 } | |
| 4240 // We shouldn't get here in this test. | 4232 // We shouldn't get here in this test. |
| 4241 FAIL() << "Unexpected read: " << rv; | 4233 FAIL() << "Unexpected read: " << rv; |
|
rvargas (doing something else)
2014/03/19 22:13:15
This just logs a message (and keeps track of the f
Peter Kasting
2014/03/19 22:17:09
Wrong. FAIL() returns from the function. You're
rvargas (doing something else)
2014/03/19 22:56:24
OK then. I still don't see the unreachable line in
Peter Kasting
2014/03/19 23:03:24
MSVC complains that the "while (rv > 0)" is an unr
| |
| 4242 } while (rv > 0); | 4234 } |
| 4235 // Complete the read now, which causes buffering to start. | |
| 4236 data.CompleteRead(); | |
|
rvargas (doing something else)
2014/03/19 22:13:15
This could end up being called when rv is not pend
Peter Kasting
2014/03/19 22:17:09
No, it can't; see my reply above.
| |
| 4237 // Destroy the transaction, causing the stream to get cancelled | |
| 4238 // and orphaning the buffered IO task. | |
| 4239 helper.ResetTrans(); | |
| 4243 | 4240 |
| 4244 // Flush the MessageLoop; this will cause the buffered IO task | 4241 // Flush the MessageLoop; this will cause the buffered IO task |
| 4245 // to run for the final time. | 4242 // to run for the final time. |
| 4246 base::RunLoop().RunUntilIdle(); | 4243 base::RunLoop().RunUntilIdle(); |
| 4247 | 4244 |
| 4248 // Verify that we consumed all test data. | 4245 // Verify that we consumed all test data. |
| 4249 helper.VerifyDataConsumed(); | 4246 helper.VerifyDataConsumed(); |
| 4250 } | 4247 } |
| 4251 | 4248 |
| 4252 // Test that if the server requests persistence of settings, that we save | 4249 // Test that if the server requests persistence of settings, that we save |
| (...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6504 // since we're send-stalled. | 6501 // since we're send-stalled. |
| 6505 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); | 6502 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); |
| 6506 | 6503 |
| 6507 // Read in WINDOW_UPDATE or SETTINGS frame. | 6504 // Read in WINDOW_UPDATE or SETTINGS frame. |
| 6508 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); | 6505 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); |
| 6509 rv = callback.WaitForResult(); | 6506 rv = callback.WaitForResult(); |
| 6510 helper.VerifyDataConsumed(); | 6507 helper.VerifyDataConsumed(); |
| 6511 } | 6508 } |
| 6512 | 6509 |
| 6513 } // namespace net | 6510 } // namespace net |
| OLD | NEW |