| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #endif | 10 #endif |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 }; | 404 }; |
| 405 | 405 |
| 406 // Inherit PlatformTest since we require the autorelease pool on Mac OS X.f | 406 // Inherit PlatformTest since we require the autorelease pool on Mac OS X.f |
| 407 class URLRequestTest : public PlatformTest { | 407 class URLRequestTest : public PlatformTest { |
| 408 public: | 408 public: |
| 409 URLRequestTest() : default_context_(new TestURLRequestContext(true)) { | 409 URLRequestTest() : default_context_(new TestURLRequestContext(true)) { |
| 410 default_context_->set_network_delegate(&default_network_delegate_); | 410 default_context_->set_network_delegate(&default_network_delegate_); |
| 411 default_context_->Init(); | 411 default_context_->Init(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 static void SetUpTestCase() { | |
| 415 URLRequest::AllowFileAccess(); | |
| 416 } | |
| 417 | |
| 418 // Adds the TestJobInterceptor to the default context. | 414 // Adds the TestJobInterceptor to the default context. |
| 419 TestJobInterceptor* AddTestInterceptor() { | 415 TestJobInterceptor* AddTestInterceptor() { |
| 420 TestJobInterceptor* interceptor = new TestJobInterceptor(); | 416 TestJobInterceptor* interceptor = new TestJobInterceptor(); |
| 421 default_context_->set_job_factory(&job_factory_); | 417 default_context_->set_job_factory(&job_factory_); |
| 422 job_factory_.AddInterceptor(interceptor); | 418 job_factory_.AddInterceptor(interceptor); |
| 423 return interceptor; | 419 return interceptor; |
| 424 } | 420 } |
| 425 | 421 |
| 426 protected: | 422 protected: |
| 427 TestNetworkDelegate default_network_delegate_; // must outlive URLRequest | 423 TestNetworkDelegate default_network_delegate_; // must outlive URLRequest |
| (...skipping 4156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4584 req.SetExtraRequestHeaders(headers); | 4580 req.SetExtraRequestHeaders(headers); |
| 4585 req.Start(); | 4581 req.Start(); |
| 4586 MessageLoop::current()->Run(); | 4582 MessageLoop::current()->Run(); |
| 4587 // If the net tests are being run with ChromeFrame then we need to allow for | 4583 // If the net tests are being run with ChromeFrame then we need to allow for |
| 4588 // the 'chromeframe' suffix which is added to the user agent before the | 4584 // the 'chromeframe' suffix which is added to the user agent before the |
| 4589 // closing parentheses. | 4585 // closing parentheses. |
| 4590 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 4586 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
| 4591 } | 4587 } |
| 4592 | 4588 |
| 4593 } // namespace net | 4589 } // namespace net |
| OLD | NEW |