| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (error.GetErrorCode() == net::ERR_ABORTED) | 216 if (error.GetErrorCode() == net::ERR_ABORTED) |
| 217 return; | 217 return; |
| 218 | 218 |
| 219 const WebRequest& failed_request = | 219 const WebRequest& failed_request = |
| 220 frame->GetProvisionalDataSource()->GetRequest(); | 220 frame->GetProvisionalDataSource()->GetRequest(); |
| 221 TestShellExtraRequestData* extra_data = | 221 TestShellExtraRequestData* extra_data = |
| 222 static_cast<TestShellExtraRequestData*>(failed_request.GetExtraData()); | 222 static_cast<TestShellExtraRequestData*>(failed_request.GetExtraData()); |
| 223 bool replace = extra_data && extra_data->pending_page_id != -1; | 223 bool replace = extra_data && extra_data->pending_page_id != -1; |
| 224 | 224 |
| 225 scoped_ptr<WebRequest> request(failed_request.Clone()); | 225 scoped_ptr<WebRequest> request(failed_request.Clone()); |
| 226 request->SetURL(GURL("testshell-error:")); | |
| 227 | 226 |
| 228 std::string error_text = | 227 std::string error_text = |
| 229 StringPrintf("Error loading url: %d", error.GetErrorCode()); | 228 StringPrintf("Error %d when loading url %s", error.GetErrorCode(), |
| 229 request->GetURL().spec().c_str()); |
| 230 request->SetURL(GURL("testshell-error:")); |
| 230 | 231 |
| 231 frame->LoadAlternateHTMLString(request.get(), error_text, | 232 frame->LoadAlternateHTMLString(request.get(), error_text, |
| 232 error.GetFailedURL(), replace); | 233 error.GetFailedURL(), replace); |
| 233 } | 234 } |
| 234 | 235 |
| 235 void TestWebViewDelegate::DidCommitLoadForFrame(WebView* webview, | 236 void TestWebViewDelegate::DidCommitLoadForFrame(WebView* webview, |
| 236 WebFrame* frame, | 237 WebFrame* frame, |
| 237 bool is_new_navigation) { | 238 bool is_new_navigation) { |
| 238 if (shell_->ShouldDumpFrameLoadCallbacks()) { | 239 if (shell_->ShouldDumpFrameLoadCallbacks()) { |
| 239 printf("%S - didCommitLoadForFrame\n", | 240 printf("%S - didCommitLoadForFrame\n", |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 else | 780 else |
| 780 return L"main frame"; | 781 return L"main frame"; |
| 781 } else { | 782 } else { |
| 782 if (name.length()) | 783 if (name.length()) |
| 783 return L"frame \"" + name + L"\""; | 784 return L"frame \"" + name + L"\""; |
| 784 else | 785 else |
| 785 return L"frame (anonymous)"; | 786 return L"frame (anonymous)"; |
| 786 } | 787 } |
| 787 } | 788 } |
| 788 | 789 |
| OLD | NEW |