Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: webkit/tools/test_shell/test_webview_delegate.cc

Issue 10536207: Remove layoutTestController from test_shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: really fix mac Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 if (!originating_node.isNull()) { 691 if (!originating_node.isNull()) {
692 printf(" originating from %s", 692 printf(" originating from %s",
693 GetNodeDescription(originating_node, 0).c_str()); 693 GetNodeDescription(originating_node, 0).c_str());
694 } 694 }
695 printf("\n"); 695 printf("\n");
696 if (policy_delegate_is_permissive_) { 696 if (policy_delegate_is_permissive_) {
697 result = WebKit::WebNavigationPolicyCurrentTab; 697 result = WebKit::WebNavigationPolicyCurrentTab;
698 } else { 698 } else {
699 result = WebKit::WebNavigationPolicyIgnore; 699 result = WebKit::WebNavigationPolicyIgnore;
700 } 700 }
701 if (policy_delegate_should_notify_done_)
702 shell_->layout_test_controller()->PolicyDelegateDone();
703 } else { 701 } else {
704 result = default_policy; 702 result = default_policy;
705 } 703 }
706 return result; 704 return result;
707 } 705 }
708 706
709 bool TestWebViewDelegate::canHandleRequest( 707 bool TestWebViewDelegate::canHandleRequest(
710 WebFrame* frame, const WebURLRequest& request) { 708 WebFrame* frame, const WebURLRequest& request) {
711 GURL url = request.url(); 709 GURL url = request.url();
712 // Just reject the scheme used in 710 // Just reject the scheme used in
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 void TestWebViewDelegate::didCreateDataSource( 751 void TestWebViewDelegate::didCreateDataSource(
754 WebFrame* frame, WebDataSource* ds) { 752 WebFrame* frame, WebDataSource* ds) {
755 ds->setExtraData(pending_extra_data_.release()); 753 ds->setExtraData(pending_extra_data_.release());
756 } 754 }
757 755
758 void TestWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) { 756 void TestWebViewDelegate::didStartProvisionalLoad(WebFrame* frame) {
759 if (!top_loading_frame_) { 757 if (!top_loading_frame_) {
760 top_loading_frame_ = frame; 758 top_loading_frame_ = frame;
761 } 759 }
762 760
763 if (shell_->layout_test_controller()->StopProvisionalFrameLoads()) {
764 printf("%s - stopping load in didStartProvisionalLoadForFrame callback\n",
765 UTF16ToUTF8(GetFrameDescription(frame)).c_str());
766 frame->stopLoading();
767 }
768 UpdateAddressBar(frame->view()); 761 UpdateAddressBar(frame->view());
769 } 762 }
770 763
771 void TestWebViewDelegate::didReceiveServerRedirectForProvisionalLoad( 764 void TestWebViewDelegate::didReceiveServerRedirectForProvisionalLoad(
772 WebFrame* frame) { 765 WebFrame* frame) {
773 UpdateAddressBar(frame->view()); 766 UpdateAddressBar(frame->view());
774 } 767 }
775 768
776 void TestWebViewDelegate::didFailProvisionalLoad( 769 void TestWebViewDelegate::didFailProvisionalLoad(
777 WebFrame* frame, const WebURLError& error) { 770 WebFrame* frame, const WebURLError& error) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 // In case the load failed before DidCreateDataSource was called. 803 // In case the load failed before DidCreateDataSource was called.
811 if (replace) 804 if (replace)
812 set_pending_extra_data(NULL); 805 set_pending_extra_data(NULL);
813 } 806 }
814 807
815 void TestWebViewDelegate::didCommitProvisionalLoad( 808 void TestWebViewDelegate::didCommitProvisionalLoad(
816 WebFrame* frame, bool is_new_navigation) { 809 WebFrame* frame, bool is_new_navigation) {
817 UpdateForCommittedLoad(frame, is_new_navigation); 810 UpdateForCommittedLoad(frame, is_new_navigation);
818 } 811 }
819 812
820 void TestWebViewDelegate::didClearWindowObject(WebFrame* frame) {
821 shell_->BindJSObjectsToWindow(frame);
822 }
823
824 void TestWebViewDelegate::didReceiveTitle( 813 void TestWebViewDelegate::didReceiveTitle(
825 WebFrame* frame, const WebString& title, WebTextDirection direction) { 814 WebFrame* frame, const WebString& title, WebTextDirection direction) {
826 SetPageTitle(title); 815 SetPageTitle(title);
827 } 816 }
828 817
829 void TestWebViewDelegate::didFinishDocumentLoad(WebFrame* frame) { 818 void TestWebViewDelegate::didFinishDocumentLoad(WebFrame* frame) {
830 unsigned pending_unload_events = frame->unloadListenerCount(); 819 unsigned pending_unload_events = frame->unloadListenerCount();
831 if (pending_unload_events) { 820 if (pending_unload_events) {
832 printf("%s - has %u onunload handler(s)\n", 821 printf("%s - has %u onunload handler(s)\n",
833 UTF16ToUTF8(GetFrameDescription(frame)).c_str(), pending_unload_events); 822 UTF16ToUTF8(GetFrameDescription(frame)).c_str(), pending_unload_events);
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 data_source = main_frame->provisionalDataSource(); 1029 data_source = main_frame->provisionalDataSource();
1041 if (!data_source) 1030 if (!data_source)
1042 return; 1031 return;
1043 1032
1044 SetAddressBarURL(data_source->request().url()); 1033 SetAddressBarURL(data_source->request().url());
1045 } 1034 }
1046 1035
1047 void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) { 1036 void TestWebViewDelegate::LocationChangeDone(WebFrame* frame) {
1048 if (frame == top_loading_frame_) { 1037 if (frame == top_loading_frame_) {
1049 top_loading_frame_ = NULL; 1038 top_loading_frame_ = NULL;
1050 1039 shell_->TestFinished();
1051 if (shell_->layout_test_mode())
1052 shell_->layout_test_controller()->LocationChangeDone();
1053 } 1040 }
1054 } 1041 }
1055 1042
1056 WebWidgetHost* TestWebViewDelegate::GetWidgetHost() { 1043 WebWidgetHost* TestWebViewDelegate::GetWidgetHost() {
1057 if (this == shell_->delegate()) 1044 if (this == shell_->delegate())
1058 return shell_->webViewHost(); 1045 return shell_->webViewHost();
1059 if (this == shell_->popup_delegate()) 1046 if (this == shell_->popup_delegate())
1060 return shell_->popupHost(); 1047 return shell_->popupHost();
1061 return NULL; 1048 return NULL;
1062 } 1049 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 } 1139 }
1153 1140
1154 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) { 1141 void TestWebViewDelegate::set_fake_window_rect(const WebRect& rect) {
1155 fake_rect_ = rect; 1142 fake_rect_ = rect;
1156 using_fake_rect_ = true; 1143 using_fake_rect_ = true;
1157 } 1144 }
1158 1145
1159 WebRect TestWebViewDelegate::fake_window_rect() { 1146 WebRect TestWebViewDelegate::fake_window_rect() {
1160 return fake_rect_; 1147 return fake_rect_;
1161 } 1148 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/test_webview_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698