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

Side by Side Diff: net/http/http_stream_factory_impl_unittest.cc

Issue 9419032: Modify the MockConnect constructor to take an enum of ASYNC or SYNC, instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix Test Break Created 8 years, 10 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 | 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 "net/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "net/base/cert_verifier.h" 10 #include "net/base/cert_verifier.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 EXPECT_EQ(-1, transport_conn_pool->last_num_streams()); 417 EXPECT_EQ(-1, transport_conn_pool->last_num_streams());
418 } 418 }
419 419
420 TEST(HttpStreamFactoryTest, JobNotifiesProxy) { 420 TEST(HttpStreamFactoryTest, JobNotifiesProxy) {
421 const char* kProxyString = "PROXY bad:99; PROXY maybe:80; DIRECT"; 421 const char* kProxyString = "PROXY bad:99; PROXY maybe:80; DIRECT";
422 SessionDependencies session_deps( 422 SessionDependencies session_deps(
423 ProxyService::CreateFixedFromPacResult(kProxyString)); 423 ProxyService::CreateFixedFromPacResult(kProxyString));
424 424
425 // First connection attempt fails 425 // First connection attempt fails
426 StaticSocketDataProvider socket_data1; 426 StaticSocketDataProvider socket_data1;
427 socket_data1.set_connect_data(MockConnect(true, ERR_ADDRESS_UNREACHABLE)); 427 socket_data1.set_connect_data(MockConnect(ASYNC, ERR_ADDRESS_UNREACHABLE));
428 session_deps.socket_factory.AddSocketDataProvider(&socket_data1); 428 session_deps.socket_factory.AddSocketDataProvider(&socket_data1);
429 429
430 // Second connection attempt succeeds 430 // Second connection attempt succeeds
431 StaticSocketDataProvider socket_data2; 431 StaticSocketDataProvider socket_data2;
432 socket_data2.set_connect_data(MockConnect(true, OK)); 432 socket_data2.set_connect_data(MockConnect(ASYNC, OK));
433 session_deps.socket_factory.AddSocketDataProvider(&socket_data2); 433 session_deps.socket_factory.AddSocketDataProvider(&socket_data2);
434 434
435 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); 435 scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps));
436 436
437 // Now request a stream. It should succeed using the second proxy in the 437 // Now request a stream. It should succeed using the second proxy in the
438 // list. 438 // list.
439 HttpRequestInfo request_info; 439 HttpRequestInfo request_info;
440 request_info.method = "GET"; 440 request_info.method = "GET";
441 request_info.url = GURL("http://www.google.com"); 441 request_info.url = GURL("http://www.google.com");
442 request_info.load_flags = 0; 442 request_info.load_flags = 0;
(...skipping 10 matching lines...) Expand all
453 const ProxyRetryInfoMap& retry_info = 453 const ProxyRetryInfoMap& retry_info =
454 session->proxy_service()->proxy_retry_info(); 454 session->proxy_service()->proxy_retry_info();
455 EXPECT_EQ(1u, retry_info.size()); 455 EXPECT_EQ(1u, retry_info.size());
456 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); 456 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99");
457 EXPECT_TRUE(iter != retry_info.end()); 457 EXPECT_TRUE(iter != retry_info.end());
458 } 458 }
459 459
460 } // namespace 460 } // namespace
461 461
462 } // namespace net 462 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698