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

Side by Side Diff: net/flip/flip_network_transaction_unittest.cc

Issue 384024: There was confusion in the mock socket classes due to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/flip/flip_network_transaction.h" 5 #include "net/flip/flip_network_transaction.h"
6 6
7 #include "net/base/completion_callback.h" 7 #include "net/base/completion_callback.h"
8 #include "net/base/mock_host_resolver.h" 8 #include "net/base/mock_host_resolver.h"
9 #include "net/base/ssl_config_service_defaults.h" 9 #include "net/base/ssl_config_service_defaults.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 MockWrite writes[]) { 149 MockWrite writes[]) {
150 TransactionHelperResult out; 150 TransactionHelperResult out;
151 151
152 // We disable SSL for this test. 152 // We disable SSL for this test.
153 FlipSession::SetSSLMode(false); 153 FlipSession::SetSSLMode(false);
154 154
155 SessionDependencies session_deps; 155 SessionDependencies session_deps;
156 scoped_ptr<FlipNetworkTransaction> trans( 156 scoped_ptr<FlipNetworkTransaction> trans(
157 new FlipNetworkTransaction(CreateSession(&session_deps))); 157 new FlipNetworkTransaction(CreateSession(&session_deps)));
158 158
159 StaticMockSocket data(reads, writes); 159 StaticSocketDataProvider data(reads, writes);
160 session_deps.socket_factory.AddMockSocket(&data); 160 session_deps.socket_factory.AddSocketDataProvider(&data);
161 161
162 TestCompletionCallback callback; 162 TestCompletionCallback callback;
163 163
164 int rv = trans->Start(&request, &callback, NULL); 164 int rv = trans->Start(&request, &callback, NULL);
165 EXPECT_EQ(ERR_IO_PENDING, rv); 165 EXPECT_EQ(ERR_IO_PENDING, rv);
166 166
167 out.rv = callback.WaitForResult(); 167 out.rv = callback.WaitForResult();
168 if (out.rv != OK) 168 if (out.rv != OK)
169 return out; 169 return out;
170 170
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 request.url = GURL("http://www.google.com/"); 421 request.url = GURL("http://www.google.com/");
422 request.load_flags = 0; 422 request.load_flags = 0;
423 423
424 // We disable SSL for this test. 424 // We disable SSL for this test.
425 FlipSession::SetSSLMode(false); 425 FlipSession::SetSSLMode(false);
426 426
427 SessionDependencies session_deps; 427 SessionDependencies session_deps;
428 scoped_ptr<FlipNetworkTransaction> trans( 428 scoped_ptr<FlipNetworkTransaction> trans(
429 new FlipNetworkTransaction(CreateSession(&session_deps))); 429 new FlipNetworkTransaction(CreateSession(&session_deps)));
430 430
431 StaticMockSocket data(reads, writes); 431 StaticSocketDataProvider data(reads, writes);
432 session_deps.socket_factory.AddMockSocket(&data); 432 session_deps.socket_factory.AddSocketDataProvider(&data);
433 433
434 TestCompletionCallback callback; 434 TestCompletionCallback callback;
435 435
436 int rv = trans->Start(&request, &callback, NULL); 436 int rv = trans->Start(&request, &callback, NULL);
437 EXPECT_EQ(ERR_IO_PENDING, rv); 437 EXPECT_EQ(ERR_IO_PENDING, rv);
438 trans.reset(); // Cancel the transaction. 438 trans.reset(); // Cancel the transaction.
439 439
440 // Flush the MessageLoop while the SessionDependencies (in particular, the 440 // Flush the MessageLoop while the SessionDependencies (in particular, the
441 // MockClientSocketFactory) are still alive. 441 // MockClientSocketFactory) are still alive.
442 MessageLoop::current()->RunAllPending(); 442 MessageLoop::current()->RunAllPending();
443 } 443 }
444 444
445 } // namespace net 445 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/ftp/ftp_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698