| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "net/base/upload_file_element_reader.h" | 38 #include "net/base/upload_file_element_reader.h" |
| 39 #include "net/dns/mock_host_resolver.h" | 39 #include "net/dns/mock_host_resolver.h" |
| 40 #include "net/http/http_response_headers.h" | 40 #include "net/http/http_response_headers.h" |
| 41 #include "net/test/embedded_test_server/embedded_test_server.h" | 41 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 42 #include "net/url_request/url_fetcher_delegate.h" | 42 #include "net/url_request/url_fetcher_delegate.h" |
| 43 #include "net/url_request/url_request_context_getter.h" | 43 #include "net/url_request/url_request_context_getter.h" |
| 44 #include "net/url_request/url_request_test_util.h" | 44 #include "net/url_request/url_request_test_util.h" |
| 45 #include "net/url_request/url_request_throttler_manager.h" | 45 #include "net/url_request/url_request_throttler_manager.h" |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 47 | 47 |
| 48 #if defined(USE_NSS_VERIFIER) | 48 #if defined(USE_NSS_CERTS) |
| 49 #include "net/cert_net/nss_ocsp.h" | 49 #include "net/cert_net/nss_ocsp.h" |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 namespace net { | 52 namespace net { |
| 53 | 53 |
| 54 using base::Time; | 54 using base::Time; |
| 55 using base::TimeDelta; | 55 using base::TimeDelta; |
| 56 | 56 |
| 57 // TODO(eroman): Add a regression test for http://crbug.com/40505. | 57 // TODO(eroman): Add a regression test for http://crbug.com/40505. |
| 58 | 58 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 void SetUp() override { | 418 void SetUp() override { |
| 419 SetUpServer(); | 419 SetUpServer(); |
| 420 ASSERT_TRUE(test_server_->Start()); | 420 ASSERT_TRUE(test_server_->Start()); |
| 421 | 421 |
| 422 // URL that will hang when lookups reach the host resolver. | 422 // URL that will hang when lookups reach the host resolver. |
| 423 hanging_url_ = GURL(base::StringPrintf( | 423 hanging_url_ = GURL(base::StringPrintf( |
| 424 "http://example.com:%d%s", test_server_->host_port_pair().port(), | 424 "http://example.com:%d%s", test_server_->host_port_pair().port(), |
| 425 kDefaultResponsePath)); | 425 kDefaultResponsePath)); |
| 426 ASSERT_TRUE(hanging_url_.is_valid()); | 426 ASSERT_TRUE(hanging_url_.is_valid()); |
| 427 | 427 |
| 428 #if defined(USE_NSS_VERIFIER) | 428 #if defined(USE_NSS_CERTS) |
| 429 crypto::EnsureNSSInit(); | 429 crypto::EnsureNSSInit(); |
| 430 EnsureNSSHttpIOInit(); | 430 EnsureNSSHttpIOInit(); |
| 431 #endif | 431 #endif |
| 432 } | 432 } |
| 433 | 433 |
| 434 void TearDown() override { | 434 void TearDown() override { |
| 435 #if defined(USE_NSS_VERIFIER) | 435 #if defined(USE_NSS_CERTS) |
| 436 ShutdownNSSHttpIO(); | 436 ShutdownNSSHttpIO(); |
| 437 #endif | 437 #endif |
| 438 } | 438 } |
| 439 | 439 |
| 440 // Initializes |test_server_| without starting it. Allows subclasses to use | 440 // Initializes |test_server_| without starting it. Allows subclasses to use |
| 441 // their own server configuration. | 441 // their own server configuration. |
| 442 virtual void SetUpServer() { | 442 virtual void SetUpServer() { |
| 443 test_server_.reset(new EmbeddedTestServer); | 443 test_server_.reset(new EmbeddedTestServer); |
| 444 test_server_->AddDefaultHandlers(base::FilePath(kDocRoot)); | 444 test_server_->AddDefaultHandlers(base::FilePath(kDocRoot)); |
| 445 } | 445 } |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1523 EXPECT_EQ(-1, delegate.fetcher()->GetResponseCode()); | 1523 EXPECT_EQ(-1, delegate.fetcher()->GetResponseCode()); |
| 1524 EXPECT_TRUE(delegate.fetcher()->GetCookies().empty()); | 1524 EXPECT_TRUE(delegate.fetcher()->GetCookies().empty()); |
| 1525 std::string data; | 1525 std::string data; |
| 1526 EXPECT_TRUE(delegate.fetcher()->GetResponseAsString(&data)); | 1526 EXPECT_TRUE(delegate.fetcher()->GetResponseAsString(&data)); |
| 1527 EXPECT_TRUE(data.empty()); | 1527 EXPECT_TRUE(data.empty()); |
| 1528 } | 1528 } |
| 1529 | 1529 |
| 1530 } // namespace | 1530 } // namespace |
| 1531 | 1531 |
| 1532 } // namespace net | 1532 } // namespace net |
| OLD | NEW |