| 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 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2761 scoped_ptr<OrderedSocketData> data2( | 2761 scoped_ptr<OrderedSocketData> data2( |
| 2762 new OrderedSocketData(reads2, arraysize(reads2), | 2762 new OrderedSocketData(reads2, arraysize(reads2), |
| 2763 writes2, arraysize(writes2))); | 2763 writes2, arraysize(writes2))); |
| 2764 | 2764 |
| 2765 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 2765 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
| 2766 HttpStreamFactory::set_force_spdy_over_ssl(false); | 2766 HttpStreamFactory::set_force_spdy_over_ssl(false); |
| 2767 HttpStreamFactory::set_force_spdy_always(true); | 2767 HttpStreamFactory::set_force_spdy_always(true); |
| 2768 TestDelegate d; | 2768 TestDelegate d; |
| 2769 { | 2769 { |
| 2770 SpdyURLRequestContext spdy_url_request_context; | 2770 SpdyURLRequestContext spdy_url_request_context; |
| 2771 net::URLRequest r(GURL("http://www.google.com/"), &d); | 2771 net::URLRequest r( |
| 2772 r.set_context(&spdy_url_request_context); | 2772 GURL("http://www.google.com/"), &d, &spdy_url_request_context); |
| 2773 spdy_url_request_context.socket_factory(). | 2773 spdy_url_request_context.socket_factory(). |
| 2774 AddSocketDataProvider(data.get()); | 2774 AddSocketDataProvider(data.get()); |
| 2775 spdy_url_request_context.socket_factory(). | 2775 spdy_url_request_context.socket_factory(). |
| 2776 AddSocketDataProvider(data2.get()); | 2776 AddSocketDataProvider(data2.get()); |
| 2777 | 2777 |
| 2778 d.set_quit_on_redirect(true); | 2778 d.set_quit_on_redirect(true); |
| 2779 r.Start(); | 2779 r.Start(); |
| 2780 MessageLoop::current()->Run(); | 2780 MessageLoop::current()->Run(); |
| 2781 EXPECT_EQ(1, d.received_redirect_count()); | 2781 EXPECT_EQ(1, d.received_redirect_count()); |
| 2782 | 2782 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3019 new OrderedSocketData(reads2, arraysize(reads2), | 3019 new OrderedSocketData(reads2, arraysize(reads2), |
| 3020 writes2, arraysize(writes2))); | 3020 writes2, arraysize(writes2))); |
| 3021 | 3021 |
| 3022 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN | 3022 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN |
| 3023 HttpStreamFactory::set_force_spdy_over_ssl(false); | 3023 HttpStreamFactory::set_force_spdy_over_ssl(false); |
| 3024 HttpStreamFactory::set_force_spdy_always(true); | 3024 HttpStreamFactory::set_force_spdy_always(true); |
| 3025 TestDelegate d; | 3025 TestDelegate d; |
| 3026 TestDelegate d2; | 3026 TestDelegate d2; |
| 3027 SpdyURLRequestContext spdy_url_request_context; | 3027 SpdyURLRequestContext spdy_url_request_context; |
| 3028 { | 3028 { |
| 3029 net::URLRequest r(GURL("http://www.google.com/"), &d); | 3029 net::URLRequest r( |
| 3030 r.set_context(&spdy_url_request_context); | 3030 GURL("http://www.google.com/"), &d, &spdy_url_request_context); |
| 3031 spdy_url_request_context.socket_factory(). | 3031 spdy_url_request_context.socket_factory(). |
| 3032 AddSocketDataProvider(data.get()); | 3032 AddSocketDataProvider(data.get()); |
| 3033 | 3033 |
| 3034 r.Start(); | 3034 r.Start(); |
| 3035 MessageLoop::current()->Run(); | 3035 MessageLoop::current()->Run(); |
| 3036 | 3036 |
| 3037 EXPECT_EQ(0, d.received_redirect_count()); | 3037 EXPECT_EQ(0, d.received_redirect_count()); |
| 3038 std::string contents("hello!"); | 3038 std::string contents("hello!"); |
| 3039 EXPECT_EQ(contents, d.data_received()); | 3039 EXPECT_EQ(contents, d.data_received()); |
| 3040 | 3040 |
| 3041 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), &d2); | 3041 net::URLRequest r2( |
| 3042 r2.set_context(&spdy_url_request_context); | 3042 GURL("http://www.google.com/foo.dat"), &d2, &spdy_url_request_context); |
| 3043 spdy_url_request_context.socket_factory(). | 3043 spdy_url_request_context.socket_factory(). |
| 3044 AddSocketDataProvider(data2.get()); | 3044 AddSocketDataProvider(data2.get()); |
| 3045 | 3045 |
| 3046 d2.set_quit_on_redirect(true); | 3046 d2.set_quit_on_redirect(true); |
| 3047 r2.Start(); | 3047 r2.Start(); |
| 3048 MessageLoop::current()->Run(); | 3048 MessageLoop::current()->Run(); |
| 3049 EXPECT_EQ(1, d2.received_redirect_count()); | 3049 EXPECT_EQ(1, d2.received_redirect_count()); |
| 3050 | 3050 |
| 3051 r2.FollowDeferredRedirect(); | 3051 r2.FollowDeferredRedirect(); |
| 3052 MessageLoop::current()->Run(); | 3052 MessageLoop::current()->Run(); |
| (...skipping 3171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6224 // And now we can allow everything else to run to completion. | 6224 // And now we can allow everything else to run to completion. |
| 6225 data->SetStop(10); | 6225 data->SetStop(10); |
| 6226 data->Run(); | 6226 data->Run(); |
| 6227 EXPECT_EQ(OK, callback2.WaitForResult()); | 6227 EXPECT_EQ(OK, callback2.WaitForResult()); |
| 6228 EXPECT_EQ(OK, callback3.WaitForResult()); | 6228 EXPECT_EQ(OK, callback3.WaitForResult()); |
| 6229 | 6229 |
| 6230 helper.VerifyDataConsumed(); | 6230 helper.VerifyDataConsumed(); |
| 6231 } | 6231 } |
| 6232 | 6232 |
| 6233 } // namespace net | 6233 } // namespace net |
| OLD | NEW |