Chromium Code Reviews| 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/shell/renderer/test_runner/web_test_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 delegate->PrintMessage("(null)"); | 142 delegate->PrintMessage("(null)"); |
| 143 return; | 143 return; |
| 144 } | 144 } |
| 145 delegate->PrintMessage(base::StringPrintf( | 145 delegate->PrintMessage(base::StringPrintf( |
| 146 "<NSURLResponse %s, http status code %d>", | 146 "<NSURLResponse %s, http status code %d>", |
| 147 DescriptionSuitableForTestResult(response.url().spec()).c_str(), | 147 DescriptionSuitableForTestResult(response.url().spec()).c_str(), |
| 148 response.httpStatusCode())); | 148 response.httpStatusCode())); |
| 149 } | 149 } |
| 150 | 150 |
| 151 std::string URLDescription(const GURL& url) { | 151 std::string URLDescription(const GURL& url) { |
| 152 if (url.SchemeIs("file")) | 152 if (url.SchemeIs(url::kFileScheme)) |
| 153 return url.ExtractFileName(); | 153 return url.ExtractFileName(); |
| 154 return url.possibly_invalid_spec(); | 154 return url.possibly_invalid_spec(); |
| 155 } | 155 } |
| 156 | 156 |
| 157 std::string PriorityDescription( | 157 std::string PriorityDescription( |
| 158 const blink::WebURLRequest::Priority& priority) { | 158 const blink::WebURLRequest::Priority& priority) { |
| 159 switch (priority) { | 159 switch (priority) { |
| 160 case blink::WebURLRequest::PriorityVeryLow: | 160 case blink::WebURLRequest::PriorityVeryLow: |
| 161 return "VeryLow"; | 161 return "VeryLow"; |
| 162 case blink::WebURLRequest::PriorityLow: | 162 case blink::WebURLRequest::PriorityLow: |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1151 if (test_interfaces_->GetTestRunner()->httpHeadersToClear()) { | 1151 if (test_interfaces_->GetTestRunner()->httpHeadersToClear()) { |
| 1152 const std::set<std::string>* clearHeaders = | 1152 const std::set<std::string>* clearHeaders = |
| 1153 test_interfaces_->GetTestRunner()->httpHeadersToClear(); | 1153 test_interfaces_->GetTestRunner()->httpHeadersToClear(); |
| 1154 for (std::set<std::string>::const_iterator header = clearHeaders->begin(); | 1154 for (std::set<std::string>::const_iterator header = clearHeaders->begin(); |
| 1155 header != clearHeaders->end(); | 1155 header != clearHeaders->end(); |
| 1156 ++header) | 1156 ++header) |
| 1157 request.clearHTTPHeaderField(blink::WebString::fromUTF8(*header)); | 1157 request.clearHTTPHeaderField(blink::WebString::fromUTF8(*header)); |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 std::string host = url.host(); | 1160 std::string host = url.host(); |
| 1161 if (!host.empty() && (url.SchemeIs("http") || url.SchemeIs("https"))) { | 1161 if (!host.empty() && (url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHtt psScheme))) { |
|
Charlie Reis
2014/09/23 23:20:18
Style: Please wrap line at 80 chars (at the &&).
| |
| 1162 if (!IsLocalHost(host) && !IsTestHost(host) && | 1162 if (!IsLocalHost(host) && !IsTestHost(host) && |
| 1163 !HostIsUsedBySomeTestsToGenerateError(host) && | 1163 !HostIsUsedBySomeTestsToGenerateError(host) && |
| 1164 ((!main_document_url.SchemeIs("http") && | 1164 ((!main_document_url.SchemeIs(url::kHttpScheme) && |
| 1165 !main_document_url.SchemeIs("https")) || | 1165 !main_document_url.SchemeIs(url::kHttpsScheme)) || |
| 1166 IsLocalHost(main_document_url.host())) && | 1166 IsLocalHost(main_document_url.host())) && |
| 1167 !delegate_->AllowExternalPages()) { | 1167 !delegate_->AllowExternalPages()) { |
| 1168 delegate_->PrintMessage(std::string("Blocked access to external URL ") + | 1168 delegate_->PrintMessage(std::string("Blocked access to external URL ") + |
| 1169 request_url + "\n"); | 1169 request_url + "\n"); |
| 1170 BlockRequest(request); | 1170 BlockRequest(request); |
| 1171 return; | 1171 return; |
| 1172 } | 1172 } |
| 1173 } | 1173 } |
| 1174 | 1174 |
| 1175 // Set the new substituted URL. | 1175 // Set the new substituted URL. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1353 if (!push_client_.get()) | 1353 if (!push_client_.get()) |
| 1354 push_client_.reset(new MockWebPushClient); | 1354 push_client_.reset(new MockWebPushClient); |
| 1355 return push_client_.get(); | 1355 return push_client_.get(); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1358 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
| 1359 return GetPushClientMock(); | 1359 return GetPushClientMock(); |
| 1360 } | 1360 } |
| 1361 | 1361 |
| 1362 } // namespace content | 1362 } // namespace content |
| OLD | NEW |