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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 writes, arraysize(writes))); | 2445 writes, arraysize(writes))); |
2446 scoped_ptr<OrderedSocketData> data2( | 2446 scoped_ptr<OrderedSocketData> data2( |
2447 new OrderedSocketData(reads2, arraysize(reads2), | 2447 new OrderedSocketData(reads2, arraysize(reads2), |
2448 writes2, arraysize(writes2))); | 2448 writes2, arraysize(writes2))); |
2449 | 2449 |
2450 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2450 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
2451 HttpStreamFactory::set_force_spdy_over_ssl(false); | 2451 HttpStreamFactory::set_force_spdy_over_ssl(false); |
2452 HttpStreamFactory::set_force_spdy_always(true); | 2452 HttpStreamFactory::set_force_spdy_always(true); |
2453 TestDelegate d; | 2453 TestDelegate d; |
2454 TestDelegate d2; | 2454 TestDelegate d2; |
2455 scoped_refptr<SpdyURLRequestContext> spdy_url_request_context( | 2455 SpdyURLRequestContext spdy_url_request_context; |
2456 new SpdyURLRequestContext()); | |
2457 { | 2456 { |
2458 net::URLRequest r(GURL("http://www.google.com/"), &d); | 2457 net::URLRequest r(GURL("http://www.google.com/"), &d); |
2459 r.set_context(spdy_url_request_context); | 2458 r.set_context(&spdy_url_request_context); |
2460 spdy_url_request_context->socket_factory(). | 2459 spdy_url_request_context.socket_factory(). |
2461 AddSocketDataProvider(data.get()); | 2460 AddSocketDataProvider(data.get()); |
2462 | 2461 |
2463 r.Start(); | 2462 r.Start(); |
2464 MessageLoop::current()->Run(); | 2463 MessageLoop::current()->Run(); |
2465 | 2464 |
2466 EXPECT_EQ(0, d.received_redirect_count()); | 2465 EXPECT_EQ(0, d.received_redirect_count()); |
2467 std::string contents("hello!"); | 2466 std::string contents("hello!"); |
2468 EXPECT_EQ(contents, d.data_received()); | 2467 EXPECT_EQ(contents, d.data_received()); |
2469 | 2468 |
2470 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), &d2); | 2469 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), &d2); |
2471 r2.set_context(spdy_url_request_context); | 2470 r2.set_context(&spdy_url_request_context); |
2472 spdy_url_request_context->socket_factory(). | 2471 spdy_url_request_context.socket_factory(). |
2473 AddSocketDataProvider(data2.get()); | 2472 AddSocketDataProvider(data2.get()); |
2474 | 2473 |
2475 d2.set_quit_on_redirect(true); | 2474 d2.set_quit_on_redirect(true); |
2476 r2.Start(); | 2475 r2.Start(); |
2477 MessageLoop::current()->Run(); | 2476 MessageLoop::current()->Run(); |
2478 EXPECT_EQ(1, d2.received_redirect_count()); | 2477 EXPECT_EQ(1, d2.received_redirect_count()); |
2479 | 2478 |
2480 r2.FollowDeferredRedirect(); | 2479 r2.FollowDeferredRedirect(); |
2481 MessageLoop::current()->Run(); | 2480 MessageLoop::current()->Run(); |
2482 EXPECT_EQ(1, d2.response_started_count()); | 2481 EXPECT_EQ(1, d2.response_started_count()); |
(...skipping 3074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5557 << " Write index: " | 5556 << " Write index: " |
5558 << data->write_index(); | 5557 << data->write_index(); |
5559 | 5558 |
5560 // Verify the SYN_REPLY. | 5559 // Verify the SYN_REPLY. |
5561 HttpResponseInfo response = *trans->GetResponseInfo(); | 5560 HttpResponseInfo response = *trans->GetResponseInfo(); |
5562 EXPECT_TRUE(response.headers != NULL); | 5561 EXPECT_TRUE(response.headers != NULL); |
5563 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); | 5562 EXPECT_EQ("HTTP/1.1 200 OK", response.headers->GetStatusLine()); |
5564 } | 5563 } |
5565 | 5564 |
5566 } // namespace net | 5565 } // namespace net |
OLD | NEW |