| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file contains the implementation of TestWebViewDelegate, which serves | 5 // This file contains the implementation of TestWebViewDelegate, which serves |
| 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to | 6 // as the WebViewDelegate for the TestShellWebHost. The host is expected to |
| 7 // have initialized a MessageLoop before these methods are called. | 7 // have initialized a MessageLoop before these methods are called. |
| 8 | 8 |
| 9 #include "webkit/tools/test_shell/test_webview_delegate.h" | 9 #include "webkit/tools/test_shell/test_webview_delegate.h" |
| 10 | 10 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 217 } |
| 218 | 218 |
| 219 std::string GetErrorDescription(const WebURLError& error) { | 219 std::string GetErrorDescription(const WebURLError& error) { |
| 220 std::string domain = UTF16ToASCII(error.domain); | 220 std::string domain = UTF16ToASCII(error.domain); |
| 221 int code = error.reason; | 221 int code = error.reason; |
| 222 | 222 |
| 223 if (domain == net::kErrorDomain) { | 223 if (domain == net::kErrorDomain) { |
| 224 domain = "NSURLErrorDomain"; | 224 domain = "NSURLErrorDomain"; |
| 225 switch (error.reason) { | 225 switch (error.reason) { |
| 226 case net::ERR_ABORTED: | 226 case net::ERR_ABORTED: |
| 227 code = -999; | 227 code = -999; // NSURLErrorCancelled |
| 228 break; | 228 break; |
| 229 case net::ERR_UNSAFE_PORT: | 229 case net::ERR_UNSAFE_PORT: |
| 230 // Our unsafe port checking happens at the network stack level, but we | 230 // Our unsafe port checking happens at the network stack level, but we |
| 231 // make this translation here to match the behavior of stock WebKit. | 231 // make this translation here to match the behavior of stock WebKit. |
| 232 domain = "WebKitErrorDomain"; | 232 domain = "WebKitErrorDomain"; |
| 233 code = 103; | 233 code = 103; |
| 234 break; | 234 break; |
| 235 case net::ERR_ADDRESS_INVALID: | 235 case net::ERR_ADDRESS_INVALID: |
| 236 case net::ERR_ADDRESS_UNREACHABLE: | 236 case net::ERR_ADDRESS_UNREACHABLE: |
| 237 code = -1004; | 237 case net::ERR_NETWORK_ACCESS_DENIED: |
| 238 code = -1004; // NSURLErrorCannotConnectToHost |
| 238 break; | 239 break; |
| 239 } | 240 } |
| 240 } else { | 241 } else { |
| 241 DLOG(WARNING) << "Unknown error domain"; | 242 DLOG(WARNING) << "Unknown error domain"; |
| 242 } | 243 } |
| 243 | 244 |
| 244 return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", | 245 return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", |
| 245 domain.c_str(), code, error.unreachableURL.spec().data()); | 246 domain.c_str(), code, error.unreachableURL.spec().data()); |
| 246 } | 247 } |
| 247 | 248 |
| (...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 } | 1355 } |
| 1355 | 1356 |
| 1356 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { | 1357 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { |
| 1357 fake_rect_ = rect; | 1358 fake_rect_ = rect; |
| 1358 using_fake_rect_ = true; | 1359 using_fake_rect_ = true; |
| 1359 } | 1360 } |
| 1360 | 1361 |
| 1361 WebRect TestWebViewDelegate::fake_window_rect() { | 1362 WebRect TestWebViewDelegate::fake_window_rect() { |
| 1362 return fake_rect_; | 1363 return fake_rect_; |
| 1363 } | 1364 } |
| OLD | NEW |