| Index: net/cert_net/cert_net_fetcher_impl_unittest.cc
|
| diff --git a/net/cert_net/cert_net_fetcher_impl_unittest.cc b/net/cert_net/cert_net_fetcher_impl_unittest.cc
|
| index e3337a011a5afe368b3482aa0dc36840d7f4191f..7f5e54aef0c2e39fe80af8f3f18c4f3afea20d7d 100644
|
| --- a/net/cert_net/cert_net_fetcher_impl_unittest.cc
|
| +++ b/net/cert_net/cert_net_fetcher_impl_unittest.cc
|
| @@ -11,7 +11,7 @@
|
| #include "net/cert/mock_cert_verifier.h"
|
| #include "net/dns/mock_host_resolver.h"
|
| #include "net/http/http_server_properties_impl.h"
|
| -#include "net/test/spawned_test_server/spawned_test_server.h"
|
| +#include "net/test/embedded_test_server/embedded_test_server.h"
|
| #include "net/url_request/url_request_job_factory_impl.h"
|
| #include "net/url_request/url_request_test_util.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -135,15 +135,13 @@ class TestFetchCallback {
|
|
|
| class CertNetFetcherImplTest : public PlatformTest {
|
| public:
|
| - CertNetFetcherImplTest()
|
| - : test_server_(SpawnedTestServer::TYPE_HTTP,
|
| - SpawnedTestServer::kLocalhost,
|
| - base::FilePath(kDocRoot)) {
|
| + CertNetFetcherImplTest() {
|
| + test_server_.AddDefaultHandlers(base::FilePath(kDocRoot));
|
| context_.set_network_delegate(&network_delegate_);
|
| }
|
|
|
| protected:
|
| - SpawnedTestServer test_server_;
|
| + EmbeddedTestServer test_server_;
|
| TestNetworkDelegate network_delegate_;
|
| RequestContext context_;
|
| };
|
| @@ -168,17 +166,17 @@ TEST_F(CertNetFetcherImplTest, ParallelFetchNoDuplicates) {
|
| TestFetchCallback callback3;
|
|
|
| // Request a URL with Content-Type "application/pkix-cert"
|
| - GURL url1 = test_server_.GetURL("files/cert.crt");
|
| + GURL url1 = test_server_.GetURL("/cert.crt");
|
| scoped_ptr<CertNetFetcher::Request> request1 =
|
| StartRequest(&fetcher, url1, callback1);
|
|
|
| // Request a URL with Content-Type "application/pkix-crl"
|
| - GURL url2 = test_server_.GetURL("files/root.crl");
|
| + GURL url2 = test_server_.GetURL("/root.crl");
|
| scoped_ptr<CertNetFetcher::Request> request2 =
|
| StartRequest(&fetcher, url2, callback2);
|
|
|
| // Request a URL with Content-Type "application/pkcs7-mime"
|
| - GURL url3 = test_server_.GetURL("files/certs.p7c");
|
| + GURL url3 = test_server_.GetURL("/certs.p7c");
|
| scoped_ptr<CertNetFetcher::Request> request3 =
|
| StartRequest(&fetcher, url3, callback3);
|
|
|
| @@ -205,7 +203,7 @@ TEST_F(CertNetFetcherImplTest, ContentTypeDoesntMatter) {
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| TestFetchCallback callback;
|
| - GURL url = test_server_.GetURL("files/foo.txt");
|
| + GURL url = test_server_.GetURL("/foo.txt");
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| StartRequest(&fetcher, url, callback);
|
| scoped_ptr<FetchResult> result = callback.WaitForResult();
|
| @@ -222,7 +220,7 @@ TEST_F(CertNetFetcherImplTest, HttpStatusCode) {
|
| // Response was HTTP status 404.
|
| {
|
| TestFetchCallback callback;
|
| - GURL url = test_server_.GetURL("files/404.html");
|
| + GURL url = test_server_.GetURL("/404.html");
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| StartRequest(&fetcher, url, callback);
|
| scoped_ptr<FetchResult> result = callback.WaitForResult();
|
| @@ -232,7 +230,7 @@ TEST_F(CertNetFetcherImplTest, HttpStatusCode) {
|
| // Response was HTTP status 500.
|
| {
|
| TestFetchCallback callback;
|
| - GURL url = test_server_.GetURL("files/500.html");
|
| + GURL url = test_server_.GetURL("/500.html");
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| StartRequest(&fetcher, url, callback);
|
| scoped_ptr<FetchResult> result = callback.WaitForResult();
|
| @@ -247,7 +245,7 @@ TEST_F(CertNetFetcherImplTest, ContentDisposition) {
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| TestFetchCallback callback;
|
| - GURL url = test_server_.GetURL("files/downloadable.js");
|
| + GURL url = test_server_.GetURL("/downloadable.js");
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| StartRequest(&fetcher, url, callback);
|
| scoped_ptr<FetchResult> result = callback.WaitForResult();
|
| @@ -262,7 +260,7 @@ TEST_F(CertNetFetcherImplTest, Cache) {
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| // Fetch a URL whose HTTP headers make it cacheable for 1 hour.
|
| - GURL url(test_server_.GetURL("files/cacheable_1hr.crt"));
|
| + GURL url(test_server_.GetURL("/cacheable_1hr.crt"));
|
| {
|
| TestFetchCallback callback;
|
|
|
| @@ -275,7 +273,7 @@ TEST_F(CertNetFetcherImplTest, Cache) {
|
| EXPECT_EQ(1, network_delegate_.created_requests());
|
|
|
| // Kill the HTTP server.
|
| - ASSERT_TRUE(test_server_.Stop());
|
| + ASSERT_TRUE(test_server_.ShutdownAndWaitUntilComplete());
|
|
|
| // Fetch again -- will fail unless served from cache.
|
| {
|
| @@ -298,7 +296,7 @@ TEST_F(CertNetFetcherImplTest, TooLarge) {
|
|
|
| // This file has a response body 12 bytes long. So setting the maximum to 11
|
| // bytes will cause it to fail.
|
| - GURL url(test_server_.GetURL("files/certs.p7c"));
|
| + GURL url(test_server_.GetURL("/certs.p7c"));
|
| TestFetchCallback callback;
|
| scoped_ptr<CertNetFetcher::Request> request = fetcher.FetchCaIssuers(
|
| url, CertNetFetcher::DEFAULT, 11, callback.callback());
|
| @@ -314,7 +312,7 @@ TEST_F(CertNetFetcherImplTest, Hang) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url(test_server_.GetURL("slow/certs.p7c?5"));
|
| + GURL url(test_server_.GetURL("/slow/certs.p7c?5"));
|
| TestFetchCallback callback;
|
| scoped_ptr<CertNetFetcher::Request> request = fetcher.FetchCaIssuers(
|
| url, 10, CertNetFetcher::DEFAULT, callback.callback());
|
| @@ -329,7 +327,7 @@ TEST_F(CertNetFetcherImplTest, Gzip) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url(test_server_.GetURL("files/gzipped_crl"));
|
| + GURL url(test_server_.GetURL("/gzipped_crl"));
|
| TestFetchCallback callback;
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| StartRequest(&fetcher, url, callback);
|
| @@ -363,7 +361,7 @@ TEST_F(CertNetFetcherImplTest, RedirectToHttpsNotAllowed) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url(test_server_.GetURL("files/redirect_https"));
|
| + GURL url(test_server_.GetURL("/redirect_https"));
|
| TestFetchCallback callback;
|
|
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| @@ -409,15 +407,15 @@ TEST_F(CertNetFetcherImplTest, CancelBeforeRunningMessageLoop) {
|
| TestFetchCallback callback2;
|
| TestFetchCallback callback3;
|
|
|
| - GURL url1 = test_server_.GetURL("files/cert.crt");
|
| + GURL url1 = test_server_.GetURL("/cert.crt");
|
| scoped_ptr<CertNetFetcher::Request> request1 =
|
| StartRequest(&fetcher, url1, callback1);
|
|
|
| - GURL url2 = test_server_.GetURL("files/root.crl");
|
| + GURL url2 = test_server_.GetURL("/root.crl");
|
| scoped_ptr<CertNetFetcher::Request> request2 =
|
| StartRequest(&fetcher, url2, callback2);
|
|
|
| - GURL url3 = test_server_.GetURL("files/certs.p7c");
|
| + GURL url3 = test_server_.GetURL("/certs.p7c");
|
|
|
| scoped_ptr<CertNetFetcher::Request> request3 =
|
| StartRequest(&fetcher, url3, callback3);
|
| @@ -461,12 +459,12 @@ TEST_F(CertNetFetcherImplTest, CancelAfterRunningMessageLoop) {
|
| TestFetchCallback callback2;
|
| TestFetchCallback callback3;
|
|
|
| - GURL url1 = test_server_.GetURL("files/cert.crt");
|
| + GURL url1 = test_server_.GetURL("/cert.crt");
|
|
|
| scoped_ptr<CertNetFetcher::Request> request1 =
|
| StartRequest(&fetcher, url1, callback1);
|
|
|
| - GURL url2 = test_server_.GetURL("files/certs.p7c");
|
| + GURL url2 = test_server_.GetURL("/certs.p7c");
|
| scoped_ptr<CertNetFetcher::Request> request2 =
|
| StartRequest(&fetcher, url2, callback2);
|
|
|
| @@ -499,7 +497,7 @@ TEST_F(CertNetFetcherImplTest, DeleteCancels) {
|
|
|
| scoped_ptr<CertNetFetcherImpl> fetcher(new CertNetFetcherImpl(&context_));
|
|
|
| - GURL url(test_server_.GetURL("slow/certs.p7c?20"));
|
| + GURL url(test_server_.GetURL("/slow/certs.p7c?20"));
|
| TestFetchCallback callback;
|
| scoped_ptr<CertNetFetcher::Request> request =
|
| StartRequest(fetcher.get(), url, callback);
|
| @@ -515,8 +513,8 @@ TEST_F(CertNetFetcherImplTest, ParallelFetchDuplicates) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url1 = test_server_.GetURL("files/cert.crt");
|
| - GURL url2 = test_server_.GetURL("files/root.crl");
|
| + GURL url1 = test_server_.GetURL("/cert.crt");
|
| + GURL url2 = test_server_.GetURL("/root.crl");
|
|
|
| // Issue 3 requests for url1, and 3 requests for url2
|
| TestFetchCallback callback1;
|
| @@ -578,7 +576,7 @@ TEST_F(CertNetFetcherImplTest, CancelThenStart) {
|
| TestFetchCallback callback2;
|
| TestFetchCallback callback3;
|
|
|
| - GURL url = test_server_.GetURL("files/cert.crt");
|
| + GURL url = test_server_.GetURL("/cert.crt");
|
|
|
| scoped_ptr<CertNetFetcher::Request> request1 =
|
| StartRequest(&fetcher, url, callback1);
|
| @@ -611,7 +609,7 @@ TEST_F(CertNetFetcherImplTest, CancelAll) {
|
| TestFetchCallback callback[3];
|
| scoped_ptr<CertNetFetcher::Request> request[3];
|
|
|
| - GURL url = test_server_.GetURL("files/cert.crt");
|
| + GURL url = test_server_.GetURL("/cert.crt");
|
|
|
| for (size_t i = 0; i < arraysize(callback); ++i) {
|
| request[i] = StartRequest(&fetcher, url, callback[i]);
|
| @@ -638,7 +636,7 @@ TEST_F(CertNetFetcherImplTest, DeleteWithinCallback) {
|
| // Deleted by callback2.
|
| CertNetFetcher* fetcher = new CertNetFetcherImpl(&context_);
|
|
|
| - GURL url = test_server_.GetURL("files/cert.crt");
|
| + GURL url = test_server_.GetURL("/cert.crt");
|
|
|
| TestFetchCallback callback[4];
|
| scoped_ptr<CertNetFetcher::Request> reqs[4];
|
| @@ -670,7 +668,7 @@ TEST_F(CertNetFetcherImplTest, FetchWithinCallback) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url = test_server_.GetURL("files/cert.crt");
|
| + GURL url = test_server_.GetURL("/cert.crt");
|
|
|
| TestFetchCallback callback[5];
|
| scoped_ptr<CertNetFetcher::Request> req[5];
|
| @@ -702,7 +700,7 @@ TEST_F(CertNetFetcherImplTest, CancelWithinCallback) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url = test_server_.GetURL("files/cert.crt");
|
| + GURL url = test_server_.GetURL("/cert.crt");
|
|
|
| TestFetchCallback callback[4];
|
| scoped_ptr<CertNetFetcher::Request> request[4];
|
| @@ -734,7 +732,7 @@ TEST_F(CertNetFetcherImplTest, CancelLastRequestWithinCallback) {
|
|
|
| CertNetFetcherImpl fetcher(&context_);
|
|
|
| - GURL url = test_server_.GetURL("files/cert.crt");
|
| + GURL url = test_server_.GetURL("/cert.crt");
|
|
|
| TestFetchCallback callback1;
|
| scoped_ptr<CertNetFetcher::Request> request1 =
|
|
|