| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/browser/webui/url_data_manager_backend.h" | 8 #include "content/browser/webui/url_data_manager_backend.h" |
| 9 #include "content/public/test/mock_resource_context.h" | 9 #include "content/public/test/mock_resource_context.h" |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 &resource_context_, false, nullptr, nullptr)); | 48 &resource_context_, false, nullptr, nullptr)); |
| 49 url_request_context_.set_job_factory(&url_request_job_factory_); | 49 url_request_context_.set_job_factory(&url_request_job_factory_); |
| 50 } | 50 } |
| 51 | 51 |
| 52 scoped_ptr<net::URLRequest> CreateRequest(net::URLRequest::Delegate* delegate, | 52 scoped_ptr<net::URLRequest> CreateRequest(net::URLRequest::Delegate* delegate, |
| 53 const char* origin) { | 53 const char* origin) { |
| 54 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( | 54 scoped_ptr<net::URLRequest> request = url_request_context_.CreateRequest( |
| 55 GURL("chrome://resources/polymer/v1_0/polymer/polymer-extracted.js"), | 55 GURL("chrome://resources/polymer/v1_0/polymer/polymer-extracted.js"), |
| 56 net::HIGHEST, delegate); | 56 net::HIGHEST, delegate); |
| 57 request->SetExtraRequestHeaderByName("Origin", origin, true); | 57 request->SetExtraRequestHeaderByName("Origin", origin, true); |
| 58 return request.Pass(); | 58 return request; |
| 59 } | 59 } |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 TestBrowserThreadBundle thread_bundle_; | 62 TestBrowserThreadBundle thread_bundle_; |
| 63 MockResourceContext resource_context_; | 63 MockResourceContext resource_context_; |
| 64 net::URLRequestJobFactoryImpl url_request_job_factory_; | 64 net::URLRequestJobFactoryImpl url_request_job_factory_; |
| 65 net::URLRequestContext url_request_context_; | 65 net::URLRequestContext url_request_context_; |
| 66 net::TestDelegate delegate_; | 66 net::TestDelegate delegate_; |
| 67 }; | 67 }; |
| 68 | 68 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 scoped_ptr<net::URLRequest> error_request = | 124 scoped_ptr<net::URLRequest> error_request = |
| 125 url_request_context_.CreateRequest( | 125 url_request_context_.CreateRequest( |
| 126 GURL("chrome://network-error/-123456789"), net::HIGHEST, &delegate_); | 126 GURL("chrome://network-error/-123456789"), net::HIGHEST, &delegate_); |
| 127 error_request->Start(); | 127 error_request->Start(); |
| 128 base::RunLoop().Run(); | 128 base::RunLoop().Run(); |
| 129 EXPECT_EQ(net::URLRequestStatus::FAILED, error_request->status().status()); | 129 EXPECT_EQ(net::URLRequestStatus::FAILED, error_request->status().status()); |
| 130 EXPECT_EQ(net::ERR_INVALID_URL, error_request->status().error()); | 130 EXPECT_EQ(net::ERR_INVALID_URL, error_request->status().error()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace content | 133 } // namespace content |
| OLD | NEW |