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

Side by Side Diff: net/spdy/spdy_network_transaction_spdy2_unittest.cc

Issue 10559036: Added URLRequestContext to constructor for URLRequest. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merged with latest version Created 8 years, 6 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
OLDNEW
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 2179 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 scoped_ptr<OrderedSocketData> data2( 2190 scoped_ptr<OrderedSocketData> data2(
2191 new OrderedSocketData(reads2, arraysize(reads2), 2191 new OrderedSocketData(reads2, arraysize(reads2),
2192 writes2, arraysize(writes2))); 2192 writes2, arraysize(writes2)));
2193 2193
2194 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2194 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2195 HttpStreamFactory::set_force_spdy_over_ssl(false); 2195 HttpStreamFactory::set_force_spdy_over_ssl(false);
2196 HttpStreamFactory::set_force_spdy_always(true); 2196 HttpStreamFactory::set_force_spdy_always(true);
2197 TestDelegate d; 2197 TestDelegate d;
2198 { 2198 {
2199 SpdyURLRequestContext spdy_url_request_context; 2199 SpdyURLRequestContext spdy_url_request_context;
2200 net::URLRequest r(GURL("http://www.google.com/"), &d); 2200 net::URLRequest r(
2201 r.set_context(&spdy_url_request_context); 2201 GURL("http://www.google.com/"), &d, &spdy_url_request_context);
2202 spdy_url_request_context.socket_factory(). 2202 spdy_url_request_context.socket_factory().
2203 AddSocketDataProvider(data.get()); 2203 AddSocketDataProvider(data.get());
2204 spdy_url_request_context.socket_factory(). 2204 spdy_url_request_context.socket_factory().
2205 AddSocketDataProvider(data2.get()); 2205 AddSocketDataProvider(data2.get());
2206 2206
2207 d.set_quit_on_redirect(true); 2207 d.set_quit_on_redirect(true);
2208 r.Start(); 2208 r.Start();
2209 MessageLoop::current()->Run(); 2209 MessageLoop::current()->Run();
2210 2210
2211 EXPECT_EQ(1, d.received_redirect_count()); 2211 EXPECT_EQ(1, d.received_redirect_count());
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 new OrderedSocketData(reads2, arraysize(reads2), 2446 new OrderedSocketData(reads2, arraysize(reads2),
2447 writes2, arraysize(writes2))); 2447 writes2, arraysize(writes2)));
2448 2448
2449 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2449 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2450 HttpStreamFactory::set_force_spdy_over_ssl(false); 2450 HttpStreamFactory::set_force_spdy_over_ssl(false);
2451 HttpStreamFactory::set_force_spdy_always(true); 2451 HttpStreamFactory::set_force_spdy_always(true);
2452 TestDelegate d; 2452 TestDelegate d;
2453 TestDelegate d2; 2453 TestDelegate d2;
2454 SpdyURLRequestContext spdy_url_request_context; 2454 SpdyURLRequestContext spdy_url_request_context;
2455 { 2455 {
2456 net::URLRequest r(GURL("http://www.google.com/"), &d); 2456 net::URLRequest r(
2457 r.set_context(&spdy_url_request_context); 2457 GURL("http://www.google.com/"), &d, &spdy_url_request_context);
2458 spdy_url_request_context.socket_factory(). 2458 spdy_url_request_context.socket_factory().
2459 AddSocketDataProvider(data.get()); 2459 AddSocketDataProvider(data.get());
2460 2460
2461 r.Start(); 2461 r.Start();
2462 MessageLoop::current()->Run(); 2462 MessageLoop::current()->Run();
2463 2463
2464 EXPECT_EQ(0, d.received_redirect_count()); 2464 EXPECT_EQ(0, d.received_redirect_count());
2465 std::string contents("hello!"); 2465 std::string contents("hello!");
2466 EXPECT_EQ(contents, d.data_received()); 2466 EXPECT_EQ(contents, d.data_received());
2467 2467
2468 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), &d2); 2468 net::URLRequest r2(
2469 r2.set_context(&spdy_url_request_context); 2469 GURL("http://www.google.com/foo.dat"), &d2, &spdy_url_request_context);
2470 spdy_url_request_context.socket_factory(). 2470 spdy_url_request_context.socket_factory().
2471 AddSocketDataProvider(data2.get()); 2471 AddSocketDataProvider(data2.get());
2472 2472
2473 d2.set_quit_on_redirect(true); 2473 d2.set_quit_on_redirect(true);
2474 r2.Start(); 2474 r2.Start();
2475 MessageLoop::current()->Run(); 2475 MessageLoop::current()->Run();
2476 EXPECT_EQ(1, d2.received_redirect_count()); 2476 EXPECT_EQ(1, d2.received_redirect_count());
2477 2477
2478 r2.FollowDeferredRedirect(); 2478 r2.FollowDeferredRedirect();
2479 MessageLoop::current()->Run(); 2479 MessageLoop::current()->Run();
(...skipping 3161 matching lines...) Expand 10 before | Expand all | Expand 10 after
5641 // And now we can allow everything else to run to completion. 5641 // And now we can allow everything else to run to completion.
5642 data->SetStop(10); 5642 data->SetStop(10);
5643 data->Run(); 5643 data->Run();
5644 EXPECT_EQ(OK, callback2.WaitForResult()); 5644 EXPECT_EQ(OK, callback2.WaitForResult());
5645 EXPECT_EQ(OK, callback3.WaitForResult()); 5645 EXPECT_EQ(OK, callback3.WaitForResult());
5646 5646
5647 helper.VerifyDataConsumed(); 5647 helper.VerifyDataConsumed();
5648 } 5648 }
5649 5649
5650 } // namespace net 5650 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698