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

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: Fix compile error from rebase 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,
2473 NULL);
2471 spdy_url_request_context.socket_factory(). 2474 spdy_url_request_context.socket_factory().
2472 AddSocketDataProvider(&data); 2475 AddSocketDataProvider(&data);
2473 spdy_url_request_context.socket_factory(). 2476 spdy_url_request_context.socket_factory().
2474 AddSocketDataProvider(&data2); 2477 AddSocketDataProvider(&data2);
2475 2478
2476 d.set_quit_on_redirect(true); 2479 d.set_quit_on_redirect(true);
2477 r.Start(); 2480 r.Start();
2478 base::RunLoop().Run(); 2481 base::RunLoop().Run();
2479 2482
2480 EXPECT_EQ(1, d.received_redirect_count()); 2483 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), 2555 OrderedSocketData data2(reads2, arraysize(reads2),
2553 writes2, arraysize(writes2)); 2556 writes2, arraysize(writes2));
2554 2557
2555 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2558 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2556 HttpStreamFactory::set_force_spdy_over_ssl(false); 2559 HttpStreamFactory::set_force_spdy_over_ssl(false);
2557 HttpStreamFactory::set_force_spdy_always(true); 2560 HttpStreamFactory::set_force_spdy_always(true);
2558 TestDelegate d; 2561 TestDelegate d;
2559 TestDelegate d2; 2562 TestDelegate d2;
2560 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol); 2563 SpdyURLRequestContext spdy_url_request_context(GetParam().protocol);
2561 { 2564 {
2562 net::URLRequest r( 2565 net::URLRequest r(GURL("http://www.google.com/"),
2563 GURL("http://www.google.com/"), &d, &spdy_url_request_context); 2566 DEFAULT_PRIORITY,
2567 &d,
2568 &spdy_url_request_context,
2569 NULL);
2564 spdy_url_request_context.socket_factory(). 2570 spdy_url_request_context.socket_factory().
2565 AddSocketDataProvider(&data); 2571 AddSocketDataProvider(&data);
2566 2572
2567 r.Start(); 2573 r.Start();
2568 base::RunLoop().Run(); 2574 base::RunLoop().Run();
2569 2575
2570 EXPECT_EQ(0, d.received_redirect_count()); 2576 EXPECT_EQ(0, d.received_redirect_count());
2571 std::string contents("hello!"); 2577 std::string contents("hello!");
2572 EXPECT_EQ(contents, d.data_received()); 2578 EXPECT_EQ(contents, d.data_received());
2573 2579
2574 net::URLRequest r2( 2580 net::URLRequest r2(GURL("http://www.google.com/foo.dat"),
2575 GURL("http://www.google.com/foo.dat"), &d2, &spdy_url_request_context); 2581 DEFAULT_PRIORITY,
2582 &d2,
2583 &spdy_url_request_context,
2584 NULL);
2576 spdy_url_request_context.socket_factory(). 2585 spdy_url_request_context.socket_factory().
2577 AddSocketDataProvider(&data2); 2586 AddSocketDataProvider(&data2);
2578 2587
2579 d2.set_quit_on_redirect(true); 2588 d2.set_quit_on_redirect(true);
2580 r2.Start(); 2589 r2.Start();
2581 base::RunLoop().Run(); 2590 base::RunLoop().Run();
2582 EXPECT_EQ(1, d2.received_redirect_count()); 2591 EXPECT_EQ(1, d2.received_redirect_count());
2583 2592
2584 r2.FollowDeferredRedirect(); 2593 r2.FollowDeferredRedirect();
2585 base::RunLoop().Run(); 2594 base::RunLoop().Run();
(...skipping 3824 matching lines...) Expand 10 before | Expand all | Expand 10 after
6410 // since we're send-stalled. 6419 // since we're send-stalled.
6411 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control()); 6420 EXPECT_TRUE(stream->stream()->send_stalled_by_flow_control());
6412 6421
6413 // Read in WINDOW_UPDATE or SETTINGS frame. 6422 // Read in WINDOW_UPDATE or SETTINGS frame.
6414 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7); 6423 data.RunFor((GetParam().protocol >= kProtoSPDY31) ? 8 : 7);
6415 rv = callback.WaitForResult(); 6424 rv = callback.WaitForResult();
6416 helper.VerifyDataConsumed(); 6425 helper.VerifyDataConsumed();
6417 } 6426 }
6418 6427
6419 } // namespace net 6428 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698