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

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

Issue 51953002: [Net] Add a priority parameter to URLRequest's constructor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 1 month 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
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 <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 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 writes, arraysize(writes)); 2459 writes, arraysize(writes));
2460 OrderedSocketData data2(reads2, arraysize(reads2), 2460 OrderedSocketData data2(reads2, arraysize(reads2),
2461 writes2, arraysize(writes2)); 2461 writes2, arraysize(writes2));
2462 2462
2463 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2463 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2464 HttpStreamFactory::set_force_spdy_over_ssl(false); 2464 HttpStreamFactory::set_force_spdy_over_ssl(false);
2465 HttpStreamFactory::set_force_spdy_always(true); 2465 HttpStreamFactory::set_force_spdy_always(true);
2466 TestDelegate d; 2466 TestDelegate d;
2467 { 2467 {
2468 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); 2468 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol);
2469 net::URLRequest r( 2469 net::URLRequest r(GURL("http://www.google.com/"),
2470 GURL("http://www.google.com/"), &d, &spdy_url_request_context); 2470 DEFAULT_PRIORITY,
2471 &d,
2472 &spdy_url_request_context);
2471 spdy_url_request_context.socket_factory(). 2473 spdy_url_request_context.socket_factory().
2472 AddSocketDataProvider(&data); 2474 AddSocketDataProvider(&data);
2473 spdy_url_request_context.socket_factory(). 2475 spdy_url_request_context.socket_factory().
2474 AddSocketDataProvider(&data2); 2476 AddSocketDataProvider(&data2);
2475 2477
2476 d.set_quit_on_redirect(true); 2478 d.set_quit_on_redirect(true);
2477 r.Start(); 2479 r.Start();
2478 base::RunLoop().Run(); 2480 base::RunLoop().Run();
2479 2481
2480 EXPECT_EQ(1, d.received_redirect_count()); 2482 EXPECT_EQ(1, d.received_redirect_count());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 OrderedSocketData data2(reads2, arraysize(reads2), 2554 OrderedSocketData data2(reads2, arraysize(reads2),
2553 writes2, arraysize(writes2)); 2555 writes2, arraysize(writes2));
2554 2556
2555 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2557 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2556 HttpStreamFactory::set_force_spdy_over_ssl(false); 2558 HttpStreamFactory::set_force_spdy_over_ssl(false);
2557 HttpStreamFactory::set_force_spdy_always(true); 2559 HttpStreamFactory::set_force_spdy_always(true);
2558 TestDelegate d; 2560 TestDelegate d;
2559 TestDelegate d2; 2561 TestDelegate d2;
2560 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); 2562 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol);
2561 { 2563 {
2562 net::URLRequest r( 2564 net::URLRequest r(GURL("http://www.google.com/"),
2563 GURL("http://www.google.com/"), &d, &spdy_url_request_context); 2565 DEFAULT_PRIORITY,
2566 &d,
2567 &spdy_url_request_context);
2564 spdy_url_request_context.socket_factory(). 2568 spdy_url_request_context.socket_factory().
2565 AddSocketDataProvider(&data); 2569 AddSocketDataProvider(&data);
2566 2570
2567 r.Start(); 2571 r.Start();
2568 base::RunLoop().Run(); 2572 base::RunLoop().Run();
2569 2573
2570 EXPECT_EQ(0, d.received_redirect_count()); 2574 EXPECT_EQ(0, d.received_redirect_count());
2571 std::string contents("hello!"); 2575 std::string contents("hello!");
2572 EXPECT_EQ(contents, d.data_received()); 2576 EXPECT_EQ(contents, d.data_received());
2573 2577
2574 net::URLRequest r2( 2578 net::URLRequest r2(GURL("http://www.google.com/foo.dat"),
2575 GURL("http://www.google.com/foo.dat"), &d2, &spdy_url_request_context); 2579 DEFAULT_PRIORITY,
2580 &d2,
2581 &spdy_url_request_context);
2576 spdy_url_request_context.socket_factory(). 2582 spdy_url_request_context.socket_factory().
2577 AddSocketDataProvider(&data2); 2583 AddSocketDataProvider(&data2);
2578 2584
2579 d2.set_quit_on_redirect(true); 2585 d2.set_quit_on_redirect(true);
2580 r2.Start(); 2586 r2.Start();
2581 base::RunLoop().Run(); 2587 base::RunLoop().Run();
2582 EXPECT_EQ(1, d2.received_redirect_count()); 2588 EXPECT_EQ(1, d2.received_redirect_count());
2583 2589
2584 r2.FollowDeferredRedirect(); 2590 r2.FollowDeferredRedirect();
2585 base::RunLoop().Run(); 2591 base::RunLoop().Run();
(...skipping 3824 matching lines...) Expand 10 before | Expand all | Expand 10 after
6410 // since we're send-stalled. 6416 // since we're send-stalled.
6411 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); 6417 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control());
6412 6418
6413 // Read in WINDOW_UPDATE or SETTINGS frame. 6419 // Read in WINDOW_UPDATE or SETTINGS frame.
6414 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); 6420 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7);
6415 rv = callback.WaitForResult(); 6421 rv = callback.WaitForResult();
6416 helper.VerifyDataConsumed(); 6422 helper.VerifyDataConsumed();
6417 } 6423 }
6418 6424
6419 } // namespace net 6425 } // namespace net
OLDNEW
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl.cc ('k') | net/test/spawned_test_server/spawner_communicator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698