OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 namespace { | 40 namespace { |
41 | 41 |
42 const char kResponseBody[] = "some arbitrary response body"; | 42 const char kResponseBody[] = "some arbitrary response body"; |
43 | 43 |
44 // Factory for creating HttpTransactions, used by TestTransactionConsumer. | 44 // Factory for creating HttpTransactions, used by TestTransactionConsumer. |
45 class TestTransactionFactory : public HttpTransactionFactory { | 45 class TestTransactionFactory : public HttpTransactionFactory { |
46 public: | 46 public: |
47 TestTransactionFactory(const HttpNetworkSession::Params& params) | 47 TestTransactionFactory(const HttpNetworkSession::Params& params) |
48 : session_(new HttpNetworkSession(params)) {} | 48 : session_(new HttpNetworkSession(params)) {} |
49 | 49 |
50 virtual ~TestTransactionFactory() { | 50 virtual ~TestTransactionFactory() OVERRIDE { |
51 FLAGS_fake_packet_loss_percentage = 0; | 51 FLAGS_fake_packet_loss_percentage = 0; |
52 } | 52 } |
53 | 53 |
54 // HttpTransactionFactory methods | 54 // HttpTransactionFactory methods |
55 virtual int CreateTransaction(RequestPriority priority, | 55 virtual int CreateTransaction(RequestPriority priority, |
56 scoped_ptr<HttpTransaction>* trans) OVERRIDE { | 56 scoped_ptr<HttpTransaction>* trans) OVERRIDE { |
57 trans->reset(new HttpNetworkTransaction(priority, session_)); | 57 trans->reset(new HttpNetworkTransaction(priority, session_)); |
58 return OK; | 58 return OK; |
59 } | 59 } |
60 | 60 |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 base::MessageLoop::current()->Run(); | 299 base::MessageLoop::current()->Run(); |
300 | 300 |
301 for (size_t i = 0; i < num_requests; ++i) { | 301 for (size_t i = 0; i < num_requests; ++i) { |
302 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); | 302 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); |
303 } | 303 } |
304 STLDeleteElements(&consumers); | 304 STLDeleteElements(&consumers); |
305 } | 305 } |
306 | 306 |
307 } // namespace test | 307 } // namespace test |
308 } // namespace net | 308 } // namespace net |
OLD | NEW |