OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |