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/elements_upload_data_stream.h" | 10 #include "net/base/elements_upload_data_stream.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 namespace test { | 42 namespace test { |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 const char kResponseBody[] = "some arbitrary response body"; | 46 const char kResponseBody[] = "some arbitrary response body"; |
47 | 47 |
48 // Factory for creating HttpTransactions, used by TestTransactionConsumer. | 48 // Factory for creating HttpTransactions, used by TestTransactionConsumer. |
49 class TestTransactionFactory : public HttpTransactionFactory { | 49 class TestTransactionFactory : public HttpTransactionFactory { |
50 public: | 50 public: |
51 explicit TestTransactionFactory(const HttpNetworkSession::Params& params) | 51 TestTransactionFactory(const HttpNetworkSession::Params& params) |
52 : session_(new HttpNetworkSession(params)) {} | 52 : session_(new HttpNetworkSession(params)) {} |
53 | 53 |
54 ~TestTransactionFactory() override {} | 54 ~TestTransactionFactory() override {} |
55 | 55 |
56 // HttpTransactionFactory methods | 56 // HttpTransactionFactory methods |
57 int CreateTransaction(RequestPriority priority, | 57 int CreateTransaction(RequestPriority priority, |
58 scoped_ptr<HttpTransaction>* trans) override { | 58 scoped_ptr<HttpTransaction>* trans) override { |
59 trans->reset(new HttpNetworkTransaction(priority, session_.get())); | 59 trans->reset(new HttpNetworkTransaction(priority, session_.get())); |
60 return OK; | 60 return OK; |
61 } | 61 } |
62 | 62 |
63 HttpCache* GetCache() override { return nullptr; } | 63 HttpCache* GetCache() override { return nullptr; } |
64 | 64 |
65 HttpNetworkSession* GetSession() override { return session_.get(); }; | 65 HttpNetworkSession* GetSession() override { return session_.get(); }; |
66 | 66 |
67 private: | 67 private: |
68 scoped_ptr<HttpNetworkSession> session_; | 68 scoped_refptr<HttpNetworkSession> session_; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 class QuicEndToEndTest : public PlatformTest { | 73 class QuicEndToEndTest : public PlatformTest { |
74 protected: | 74 protected: |
75 QuicEndToEndTest() | 75 QuicEndToEndTest() |
76 : host_resolver_impl_(CreateResolverImpl()), | 76 : host_resolver_impl_(CreateResolverImpl()), |
77 host_resolver_(host_resolver_impl_.Pass()), | 77 host_resolver_(host_resolver_impl_.Pass()), |
78 ssl_config_service_(new SSLConfigServiceDefaults), | 78 ssl_config_service_(new SSLConfigServiceDefaults), |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 base::MessageLoop::current()->Run(); | 292 base::MessageLoop::current()->Run(); |
293 | 293 |
294 for (size_t i = 0; i < num_requests; ++i) { | 294 for (size_t i = 0; i < num_requests; ++i) { |
295 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); | 295 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); |
296 } | 296 } |
297 STLDeleteElements(&consumers); | 297 STLDeleteElements(&consumers); |
298 } | 298 } |
299 | 299 |
300 } // namespace test | 300 } // namespace test |
301 } // namespace net | 301 } // namespace net |
OLD | NEW |