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 "content/browser/webui/url_data_manager_backend.h" | 5 #include "content/browser/webui/url_data_manager_backend.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 DISALLOW_COPY_AND_ASSIGN(CancelAfterFirstReadURLRequestDelegate); | 43 DISALLOW_COPY_AND_ASSIGN(CancelAfterFirstReadURLRequestDelegate); |
44 }; | 44 }; |
45 | 45 |
46 class UrlDataManagerBackendTest : public testing::Test { | 46 class UrlDataManagerBackendTest : public testing::Test { |
47 public: | 47 public: |
48 UrlDataManagerBackendTest() | 48 UrlDataManagerBackendTest() |
49 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) { | 49 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) { |
50 // URLRequestJobFactory takes ownership of the passed in ProtocolHandler. | 50 // URLRequestJobFactory takes ownership of the passed in ProtocolHandler. |
51 url_request_job_factory_.SetProtocolHandler( | 51 url_request_job_factory_.SetProtocolHandler( |
52 "chrome", URLDataManagerBackend::CreateProtocolHandler( | 52 "chrome", URLDataManagerBackend::CreateProtocolHandler( |
53 &resource_context_, false, nullptr)); | 53 &resource_context_, nullptr)); |
54 url_request_context_.set_job_factory(&url_request_job_factory_); | 54 url_request_context_.set_job_factory(&url_request_job_factory_); |
55 } | 55 } |
56 | 56 |
57 std::unique_ptr<net::URLRequest> CreateRequest( | 57 std::unique_ptr<net::URLRequest> CreateRequest( |
58 net::URLRequest::Delegate* delegate, | 58 net::URLRequest::Delegate* delegate, |
59 const char* origin) { | 59 const char* origin) { |
60 std::unique_ptr<net::URLRequest> request = | 60 std::unique_ptr<net::URLRequest> request = |
61 url_request_context_.CreateRequest( | 61 url_request_context_.CreateRequest( |
62 GURL( | 62 GURL( |
63 "chrome://resources/polymer/v1_0/polymer/polymer-extracted.js"), | 63 "chrome://resources/polymer/v1_0/polymer/polymer-extracted.js"), |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 url_request_context_.CreateRequest( | 134 url_request_context_.CreateRequest( |
135 GURL("chrome://network-error/-123456789"), net::HIGHEST, &delegate_, | 135 GURL("chrome://network-error/-123456789"), net::HIGHEST, &delegate_, |
136 TRAFFIC_ANNOTATION_FOR_TESTS); | 136 TRAFFIC_ANNOTATION_FOR_TESTS); |
137 error_request->Start(); | 137 error_request->Start(); |
138 base::RunLoop().Run(); | 138 base::RunLoop().Run(); |
139 EXPECT_EQ(net::URLRequestStatus::FAILED, error_request->status().status()); | 139 EXPECT_EQ(net::URLRequestStatus::FAILED, error_request->status().status()); |
140 EXPECT_EQ(net::ERR_INVALID_URL, error_request->status().error()); | 140 EXPECT_EQ(net::ERR_INVALID_URL, error_request->status().error()); |
141 } | 141 } |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
OLD | NEW |