OLD | NEW |
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/url_request/url_fetcher_impl.h" | 5 #include "net/url_request/url_fetcher_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "net/base/upload_file_element_reader.h" | 26 #include "net/base/upload_file_element_reader.h" |
27 #include "net/dns/mock_host_resolver.h" | 27 #include "net/dns/mock_host_resolver.h" |
28 #include "net/http/http_response_headers.h" | 28 #include "net/http/http_response_headers.h" |
29 #include "net/test/spawned_test_server/spawned_test_server.h" | 29 #include "net/test/spawned_test_server/spawned_test_server.h" |
30 #include "net/url_request/url_fetcher_delegate.h" | 30 #include "net/url_request/url_fetcher_delegate.h" |
31 #include "net/url_request/url_request_context_getter.h" | 31 #include "net/url_request/url_request_context_getter.h" |
32 #include "net/url_request/url_request_test_util.h" | 32 #include "net/url_request/url_request_test_util.h" |
33 #include "net/url_request/url_request_throttler_manager.h" | 33 #include "net/url_request/url_request_throttler_manager.h" |
34 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
35 | 35 |
36 #if defined(USE_NSS) || defined(OS_IOS) | 36 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
37 #include "net/cert_net/nss_ocsp.h" | 37 #include "net/cert_net/nss_ocsp.h" |
38 #endif | 38 #endif |
39 | 39 |
40 namespace net { | 40 namespace net { |
41 | 41 |
42 using base::Time; | 42 using base::Time; |
43 using base::TimeDelta; | 43 using base::TimeDelta; |
44 | 44 |
45 // TODO(eroman): Add a regression test for http://crbug.com/40505. | 45 // TODO(eroman): Add a regression test for http://crbug.com/40505. |
46 | 46 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 | 180 |
181 protected: | 181 protected: |
182 // testing::Test: | 182 // testing::Test: |
183 void SetUp() override { | 183 void SetUp() override { |
184 SetUpServer(); | 184 SetUpServer(); |
185 ASSERT_TRUE(test_server_->Start()); | 185 ASSERT_TRUE(test_server_->Start()); |
186 | 186 |
187 context_.reset(new ThrottlingTestURLRequestContext()); | 187 context_.reset(new ThrottlingTestURLRequestContext()); |
188 | 188 |
189 #if defined(USE_NSS) || defined(OS_IOS) | 189 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
190 crypto::EnsureNSSInit(); | 190 crypto::EnsureNSSInit(); |
191 EnsureNSSHttpIOInit(); | 191 EnsureNSSHttpIOInit(); |
192 #endif | 192 #endif |
193 } | 193 } |
194 | 194 |
195 void TearDown() override { | 195 void TearDown() override { |
196 #if defined(USE_NSS) || defined(OS_IOS) | 196 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
197 ShutdownNSSHttpIO(); | 197 ShutdownNSSHttpIO(); |
198 #endif | 198 #endif |
199 } | 199 } |
200 | 200 |
201 // Initializes |test_server_| without starting it. Allows subclasses to use | 201 // Initializes |test_server_| without starting it. Allows subclasses to use |
202 // their own server configuration. | 202 // their own server configuration. |
203 virtual void SetUpServer() { | 203 virtual void SetUpServer() { |
204 test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, | 204 test_server_.reset(new SpawnedTestServer(SpawnedTestServer::TYPE_HTTP, |
205 SpawnedTestServer::kLocalhost, | 205 SpawnedTestServer::kLocalhost, |
206 base::FilePath(kDocRoot))); | 206 base::FilePath(kDocRoot))); |
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1333 | 1333 |
1334 base::MessageLoop::current()->RunUntilIdle(); | 1334 base::MessageLoop::current()->RunUntilIdle(); |
1335 ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << | 1335 ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << |
1336 "FilePath: " << file_path_.value(); | 1336 "FilePath: " << file_path_.value(); |
1337 } | 1337 } |
1338 } | 1338 } |
1339 | 1339 |
1340 } // namespace | 1340 } // namespace |
1341 | 1341 |
1342 } // namespace net | 1342 } // namespace net |
OLD | NEW |