| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/WebTestProxy.h" | 5 #include "content/shell/renderer/test_runner/WebTestProxy.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "content/shell/renderer/test_runner/event_sender.h" | 9 #include "content/shell/renderer/test_runner/event_sender.h" |
| 10 #include "content/shell/renderer/test_runner/MockColorChooser.h" | 10 #include "content/shell/renderer/test_runner/MockColorChooser.h" |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 if (element.hasAttribute("id")) { | 858 if (element.hasAttribute("id")) { |
| 859 message += " - id:"; | 859 message += " - id:"; |
| 860 message += element.getAttribute("id").utf8().data(); | 860 message += element.getAttribute("id").utf8().data(); |
| 861 } | 861 } |
| 862 } | 862 } |
| 863 | 863 |
| 864 m_delegate->printMessage(message + "\n"); | 864 m_delegate->printMessage(message + "\n"); |
| 865 } | 865 } |
| 866 } | 866 } |
| 867 | 867 |
| 868 void WebTestProxyBase::startDragging(WebFrame*, const WebDragData& data, WebDrag
OperationsMask mask, const WebImage&, const WebPoint&) | 868 void WebTestProxyBase::startDragging(WebLocalFrame*, const WebDragData& data, We
bDragOperationsMask mask, const WebImage&, const WebPoint&) |
| 869 { | 869 { |
| 870 // When running a test, we need to fake a drag drop operation otherwise | 870 // When running a test, we need to fake a drag drop operation otherwise |
| 871 // Windows waits for real mouse events to know when the drag is over. | 871 // Windows waits for real mouse events to know when the drag is over. |
| 872 m_testInterfaces->eventSender()->DoDragDrop(data, mask); | 872 m_testInterfaces->eventSender()->DoDragDrop(data, mask); |
| 873 } | 873 } |
| 874 | 874 |
| 875 // The output from these methods in layout test mode should match that | 875 // The output from these methods in layout test mode should match that |
| 876 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. | 876 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. |
| 877 | 877 |
| 878 void WebTestProxyBase::didChangeSelection(bool isEmptySelection) | 878 void WebTestProxyBase::didChangeSelection(bool isEmptySelection) |
| 879 { | 879 { |
| 880 if (m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) | 880 if (m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) |
| 881 m_delegate->printMessage("EDITING DELEGATE: webViewDidChangeSelection:We
bViewDidChangeSelectionNotification\n"); | 881 m_delegate->printMessage("EDITING DELEGATE: webViewDidChangeSelection:We
bViewDidChangeSelectionNotification\n"); |
| 882 } | 882 } |
| 883 | 883 |
| 884 void WebTestProxyBase::didChangeContents() | 884 void WebTestProxyBase::didChangeContents() |
| 885 { | 885 { |
| 886 if (m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) | 886 if (m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) |
| 887 m_delegate->printMessage("EDITING DELEGATE: webViewDidChange:WebViewDidC
hangeNotification\n"); | 887 m_delegate->printMessage("EDITING DELEGATE: webViewDidChange:WebViewDidC
hangeNotification\n"); |
| 888 } | 888 } |
| 889 | 889 |
| 890 bool WebTestProxyBase::createView(WebFrame*, const WebURLRequest& request, const
WebWindowFeatures&, const WebString&, WebNavigationPolicy, bool) | 890 bool WebTestProxyBase::createView(WebLocalFrame*, const WebURLRequest& request,
const WebWindowFeatures&, const WebString&, WebNavigationPolicy, bool) |
| 891 { | 891 { |
| 892 if (!m_testInterfaces->testRunner()->canOpenWindows()) | 892 if (!m_testInterfaces->testRunner()->canOpenWindows()) |
| 893 return false; | 893 return false; |
| 894 if (m_testInterfaces->testRunner()->shouldDumpCreateView()) | 894 if (m_testInterfaces->testRunner()->shouldDumpCreateView()) |
| 895 m_delegate->printMessage(string("createView(") + URLDescription(request.
url()) + ")\n"); | 895 m_delegate->printMessage(string("createView(") + URLDescription(request.
url()) + ")\n"); |
| 896 return true; | 896 return true; |
| 897 } | 897 } |
| 898 | 898 |
| 899 WebPlugin* WebTestProxyBase::createPlugin(WebFrame* frame, const WebPluginParams
& params) | 899 WebPlugin* WebTestProxyBase::createPlugin(WebLocalFrame* frame, const WebPluginP
arams& params) |
| 900 { | 900 { |
| 901 if (TestPlugin::isSupportedMimeType(params.mimeType)) | 901 if (TestPlugin::isSupportedMimeType(params.mimeType)) |
| 902 return TestPlugin::create(frame, params, m_delegate); | 902 return TestPlugin::create(frame, params, m_delegate); |
| 903 return 0; | 903 return 0; |
| 904 } | 904 } |
| 905 | 905 |
| 906 void WebTestProxyBase::setStatusText(const WebString& text) | 906 void WebTestProxyBase::setStatusText(const WebString& text) |
| 907 { | 907 { |
| 908 if (!m_testInterfaces->testRunner()->shouldDumpStatusCallbacks()) | 908 if (!m_testInterfaces->testRunner()->shouldDumpStatusCallbacks()) |
| 909 return; | 909 return; |
| 910 m_delegate->printMessage(string("UI DELEGATE STATUS CALLBACK: setStatusText:
") + text.utf8().data() + "\n"); | 910 m_delegate->printMessage(string("UI DELEGATE STATUS CALLBACK: setStatusText:
") + text.utf8().data() + "\n"); |
| 911 } | 911 } |
| 912 | 912 |
| 913 void WebTestProxyBase::didStopLoading() | 913 void WebTestProxyBase::didStopLoading() |
| 914 { | 914 { |
| 915 if (m_testInterfaces->testRunner()->shouldDumpProgressFinishedCallback()) | 915 if (m_testInterfaces->testRunner()->shouldDumpProgressFinishedCallback()) |
| 916 m_delegate->printMessage("postProgressFinishedNotification\n"); | 916 m_delegate->printMessage("postProgressFinishedNotification\n"); |
| 917 } | 917 } |
| 918 | 918 |
| 919 void WebTestProxyBase::showContextMenu(WebFrame*, const WebContextMenuData& cont
extMenuData) | 919 void WebTestProxyBase::showContextMenu(WebLocalFrame*, const WebContextMenuData&
contextMenuData) |
| 920 { | 920 { |
| 921 m_testInterfaces->eventSender()->SetContextMenuData(contextMenuData); | 921 m_testInterfaces->eventSender()->SetContextMenuData(contextMenuData); |
| 922 } | 922 } |
| 923 | 923 |
| 924 WebUserMediaClient* WebTestProxyBase::userMediaClient() | 924 WebUserMediaClient* WebTestProxyBase::userMediaClient() |
| 925 { | 925 { |
| 926 if (!m_userMediaClient.get()) | 926 if (!m_userMediaClient.get()) |
| 927 m_userMediaClient.reset(new WebUserMediaClientMock(m_delegate)); | 927 m_userMediaClient.reset(new WebUserMediaClientMock(m_delegate)); |
| 928 return m_userMediaClient.get(); | 928 return m_userMediaClient.get(); |
| 929 } | 929 } |
| 930 | 930 |
| 931 // Simulate a print by going into print mode and then exit straight away. | 931 // Simulate a print by going into print mode and then exit straight away. |
| 932 void WebTestProxyBase::printPage(WebFrame* frame) | 932 void WebTestProxyBase::printPage(WebLocalFrame* frame) |
| 933 { | 933 { |
| 934 WebSize pageSizeInPixels = webWidget()->size(); | 934 WebSize pageSizeInPixels = webWidget()->size(); |
| 935 if (pageSizeInPixels.isEmpty()) | 935 if (pageSizeInPixels.isEmpty()) |
| 936 return; | 936 return; |
| 937 WebPrintParams printParams(pageSizeInPixels); | 937 WebPrintParams printParams(pageSizeInPixels); |
| 938 frame->printBegin(printParams); | 938 frame->printBegin(printParams); |
| 939 frame->printEnd(); | 939 frame->printEnd(); |
| 940 } | 940 } |
| 941 | 941 |
| 942 WebNotificationPresenter* WebTestProxyBase::notificationPresenter() | 942 WebNotificationPresenter* WebTestProxyBase::notificationPresenter() |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 void WebTestProxyBase::didCloseChooser() | 1006 void WebTestProxyBase::didCloseChooser() |
| 1007 { | 1007 { |
| 1008 m_chooserCount--; | 1008 m_chooserCount--; |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 bool WebTestProxyBase::isChooserShown() | 1011 bool WebTestProxyBase::isChooserShown() |
| 1012 { | 1012 { |
| 1013 return 0 < m_chooserCount; | 1013 return 0 < m_chooserCount; |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 void WebTestProxyBase::didStartProvisionalLoad(WebFrame* frame) | 1016 void WebTestProxyBase::didStartProvisionalLoad(WebLocalFrame* frame) |
| 1017 { | 1017 { |
| 1018 if (!m_testInterfaces->testRunner()->topLoadingFrame()) | 1018 if (!m_testInterfaces->testRunner()->topLoadingFrame()) |
| 1019 m_testInterfaces->testRunner()->setTopLoadingFrame(frame, false); | 1019 m_testInterfaces->testRunner()->setTopLoadingFrame(frame, false); |
| 1020 | 1020 |
| 1021 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1021 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1022 printFrameDescription(m_delegate, frame); | 1022 printFrameDescription(m_delegate, frame); |
| 1023 m_delegate->printMessage(" - didStartProvisionalLoadForFrame\n"); | 1023 m_delegate->printMessage(" - didStartProvisionalLoadForFrame\n"); |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 if (m_testInterfaces->testRunner()->shouldDumpUserGestureInFrameLoadCallback
s()) | 1026 if (m_testInterfaces->testRunner()->shouldDumpUserGestureInFrameLoadCallback
s()) |
| 1027 printFrameUserGestureStatus(m_delegate, frame, " - in didStartProvisiona
lLoadForFrame\n"); | 1027 printFrameUserGestureStatus(m_delegate, frame, " - in didStartProvisiona
lLoadForFrame\n"); |
| 1028 } | 1028 } |
| 1029 | 1029 |
| 1030 void WebTestProxyBase::didReceiveServerRedirectForProvisionalLoad(WebFrame* fram
e) | 1030 void WebTestProxyBase::didReceiveServerRedirectForProvisionalLoad(WebLocalFrame*
frame) |
| 1031 { | 1031 { |
| 1032 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1032 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1033 printFrameDescription(m_delegate, frame); | 1033 printFrameDescription(m_delegate, frame); |
| 1034 m_delegate->printMessage(" - didReceiveServerRedirectForProvisionalLoadF
orFrame\n"); | 1034 m_delegate->printMessage(" - didReceiveServerRedirectForProvisionalLoadF
orFrame\n"); |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 bool WebTestProxyBase::didFailProvisionalLoad(WebFrame* frame, const WebURLError
&) | 1038 bool WebTestProxyBase::didFailProvisionalLoad(WebLocalFrame* frame, const WebURL
Error&) |
| 1039 { | 1039 { |
| 1040 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1040 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1041 printFrameDescription(m_delegate, frame); | 1041 printFrameDescription(m_delegate, frame); |
| 1042 m_delegate->printMessage(" - didFailProvisionalLoadWithError\n"); | 1042 m_delegate->printMessage(" - didFailProvisionalLoadWithError\n"); |
| 1043 } | 1043 } |
| 1044 locationChangeDone(frame); | 1044 locationChangeDone(frame); |
| 1045 return !frame->provisionalDataSource(); | 1045 return !frame->provisionalDataSource(); |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 void WebTestProxyBase::didCommitProvisionalLoad(WebFrame* frame, bool) | 1048 void WebTestProxyBase::didCommitProvisionalLoad(WebLocalFrame* frame, bool) |
| 1049 { | 1049 { |
| 1050 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1050 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1051 printFrameDescription(m_delegate, frame); | 1051 printFrameDescription(m_delegate, frame); |
| 1052 m_delegate->printMessage(" - didCommitLoadForFrame\n"); | 1052 m_delegate->printMessage(" - didCommitLoadForFrame\n"); |
| 1053 } | 1053 } |
| 1054 } | 1054 } |
| 1055 | 1055 |
| 1056 void WebTestProxyBase::didReceiveTitle(WebFrame* frame, const WebString& title,
WebTextDirection direction) | 1056 void WebTestProxyBase::didReceiveTitle(WebLocalFrame* frame, const WebString& ti
tle, WebTextDirection direction) |
| 1057 { | 1057 { |
| 1058 WebCString title8 = title.utf8(); | 1058 WebCString title8 = title.utf8(); |
| 1059 | 1059 |
| 1060 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1060 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1061 printFrameDescription(m_delegate, frame); | 1061 printFrameDescription(m_delegate, frame); |
| 1062 m_delegate->printMessage(string(" - didReceiveTitle: ") + title8.data()
+ "\n"); | 1062 m_delegate->printMessage(string(" - didReceiveTitle: ") + title8.data()
+ "\n"); |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 if (m_testInterfaces->testRunner()->shouldDumpTitleChanges()) | 1065 if (m_testInterfaces->testRunner()->shouldDumpTitleChanges()) |
| 1066 m_delegate->printMessage(string("TITLE CHANGED: '") + title8.data() + "'
\n"); | 1066 m_delegate->printMessage(string("TITLE CHANGED: '") + title8.data() + "'
\n"); |
| 1067 } | 1067 } |
| 1068 | 1068 |
| 1069 void WebTestProxyBase::didChangeIcon(WebFrame* frame, WebIconURL::Type) | 1069 void WebTestProxyBase::didChangeIcon(WebLocalFrame* frame, WebIconURL::Type) |
| 1070 { | 1070 { |
| 1071 if (m_testInterfaces->testRunner()->shouldDumpIconChanges()) { | 1071 if (m_testInterfaces->testRunner()->shouldDumpIconChanges()) { |
| 1072 printFrameDescription(m_delegate, frame); | 1072 printFrameDescription(m_delegate, frame); |
| 1073 m_delegate->printMessage(string(" - didChangeIcons\n")); | 1073 m_delegate->printMessage(string(" - didChangeIcons\n")); |
| 1074 } | 1074 } |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 void WebTestProxyBase::didFinishDocumentLoad(WebFrame* frame) | 1077 void WebTestProxyBase::didFinishDocumentLoad(WebLocalFrame* frame) |
| 1078 { | 1078 { |
| 1079 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1079 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1080 printFrameDescription(m_delegate, frame); | 1080 printFrameDescription(m_delegate, frame); |
| 1081 m_delegate->printMessage(" - didFinishDocumentLoadForFrame\n"); | 1081 m_delegate->printMessage(" - didFinishDocumentLoadForFrame\n"); |
| 1082 } else { | 1082 } else { |
| 1083 unsigned pendingUnloadEvents = frame->unloadListenerCount(); | 1083 unsigned pendingUnloadEvents = frame->unloadListenerCount(); |
| 1084 if (pendingUnloadEvents) { | 1084 if (pendingUnloadEvents) { |
| 1085 printFrameDescription(m_delegate, frame); | 1085 printFrameDescription(m_delegate, frame); |
| 1086 char buffer[100]; | 1086 char buffer[100]; |
| 1087 snprintf(buffer, sizeof(buffer), " - has %u onunload handler(s)\n",
pendingUnloadEvents); | 1087 snprintf(buffer, sizeof(buffer), " - has %u onunload handler(s)\n",
pendingUnloadEvents); |
| 1088 m_delegate->printMessage(buffer); | 1088 m_delegate->printMessage(buffer); |
| 1089 } | 1089 } |
| 1090 } | 1090 } |
| 1091 } | 1091 } |
| 1092 | 1092 |
| 1093 void WebTestProxyBase::didHandleOnloadEvents(WebFrame* frame) | 1093 void WebTestProxyBase::didHandleOnloadEvents(WebLocalFrame* frame) |
| 1094 { | 1094 { |
| 1095 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1095 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1096 printFrameDescription(m_delegate, frame); | 1096 printFrameDescription(m_delegate, frame); |
| 1097 m_delegate->printMessage(" - didHandleOnloadEventsForFrame\n"); | 1097 m_delegate->printMessage(" - didHandleOnloadEventsForFrame\n"); |
| 1098 } | 1098 } |
| 1099 } | 1099 } |
| 1100 | 1100 |
| 1101 void WebTestProxyBase::didFailLoad(WebFrame* frame, const WebURLError&) | 1101 void WebTestProxyBase::didFailLoad(WebLocalFrame* frame, const WebURLError&) |
| 1102 { | 1102 { |
| 1103 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1103 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1104 printFrameDescription(m_delegate, frame); | 1104 printFrameDescription(m_delegate, frame); |
| 1105 m_delegate->printMessage(" - didFailLoadWithError\n"); | 1105 m_delegate->printMessage(" - didFailLoadWithError\n"); |
| 1106 } | 1106 } |
| 1107 locationChangeDone(frame); | 1107 locationChangeDone(frame); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 void WebTestProxyBase::didFinishLoad(WebFrame* frame) | 1110 void WebTestProxyBase::didFinishLoad(WebLocalFrame* frame) |
| 1111 { | 1111 { |
| 1112 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { | 1112 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) { |
| 1113 printFrameDescription(m_delegate, frame); | 1113 printFrameDescription(m_delegate, frame); |
| 1114 m_delegate->printMessage(" - didFinishLoadForFrame\n"); | 1114 m_delegate->printMessage(" - didFinishLoadForFrame\n"); |
| 1115 } | 1115 } |
| 1116 locationChangeDone(frame); | 1116 locationChangeDone(frame); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 void WebTestProxyBase::didDetectXSS(WebFrame*, const WebURL&, bool) | 1119 void WebTestProxyBase::didDetectXSS(WebLocalFrame*, const WebURL&, bool) |
| 1120 { | 1120 { |
| 1121 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) | 1121 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) |
| 1122 m_delegate->printMessage("didDetectXSS\n"); | 1122 m_delegate->printMessage("didDetectXSS\n"); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 void WebTestProxyBase::didDispatchPingLoader(WebFrame*, const WebURL& url) | 1125 void WebTestProxyBase::didDispatchPingLoader(WebLocalFrame*, const WebURL& url) |
| 1126 { | 1126 { |
| 1127 if (m_testInterfaces->testRunner()->shouldDumpPingLoaderCallbacks()) | 1127 if (m_testInterfaces->testRunner()->shouldDumpPingLoaderCallbacks()) |
| 1128 m_delegate->printMessage(string("PingLoader dispatched to '") + URLDescr
iption(url).c_str() + "'.\n"); | 1128 m_delegate->printMessage(string("PingLoader dispatched to '") + URLDescr
iption(url).c_str() + "'.\n"); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 void WebTestProxyBase::willRequestResource(WebFrame* frame, const blink::WebCach
edURLRequest& request) | 1131 void WebTestProxyBase::willRequestResource(WebLocalFrame* frame, const blink::We
bCachedURLRequest& request) |
| 1132 { | 1132 { |
| 1133 if (m_testInterfaces->testRunner()->shouldDumpResourceRequestCallbacks()) { | 1133 if (m_testInterfaces->testRunner()->shouldDumpResourceRequestCallbacks()) { |
| 1134 printFrameDescription(m_delegate, frame); | 1134 printFrameDescription(m_delegate, frame); |
| 1135 m_delegate->printMessage(string(" - ") + request.initiatorName().utf8().
data()); | 1135 m_delegate->printMessage(string(" - ") + request.initiatorName().utf8().
data()); |
| 1136 m_delegate->printMessage(string(" requested '") + URLDescription(request
.urlRequest().url()).c_str() + "'\n"); | 1136 m_delegate->printMessage(string(" requested '") + URLDescription(request
.urlRequest().url()).c_str() + "'\n"); |
| 1137 } | 1137 } |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, blink::We
bURLRequest& request, const blink::WebURLResponse& redirectResponse) | 1140 void WebTestProxyBase::willSendRequest(WebLocalFrame*, unsigned identifier, blin
k::WebURLRequest& request, const blink::WebURLResponse& redirectResponse) |
| 1141 { | 1141 { |
| 1142 // Need to use GURL for host() and SchemeIs() | 1142 // Need to use GURL for host() and SchemeIs() |
| 1143 GURL url = request.url(); | 1143 GURL url = request.url(); |
| 1144 string requestURL = url.possibly_invalid_spec(); | 1144 string requestURL = url.possibly_invalid_spec(); |
| 1145 | 1145 |
| 1146 GURL mainDocumentURL = request.firstPartyForCookies(); | 1146 GURL mainDocumentURL = request.firstPartyForCookies(); |
| 1147 | 1147 |
| 1148 if (redirectResponse.isNull() && (m_testInterfaces->testRunner()->shouldDump
ResourceLoadCallbacks() || m_testInterfaces->testRunner()->shouldDumpResourcePri
orities())) { | 1148 if (redirectResponse.isNull() && (m_testInterfaces->testRunner()->shouldDump
ResourceLoadCallbacks() || m_testInterfaces->testRunner()->shouldDumpResourcePri
orities())) { |
| 1149 BLINK_ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdent
ifierMap.end()); | 1149 BLINK_ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdent
ifierMap.end()); |
| 1150 m_resourceIdentifierMap[identifier] = descriptionSuitableForTestResult(r
equestURL); | 1150 m_resourceIdentifierMap[identifier] = descriptionSuitableForTestResult(r
equestURL); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 m_delegate->printMessage(string("Blocked access to external URL ") +
requestURL + "\n"); | 1187 m_delegate->printMessage(string("Blocked access to external URL ") +
requestURL + "\n"); |
| 1188 blockRequest(request); | 1188 blockRequest(request); |
| 1189 return; | 1189 return; |
| 1190 } | 1190 } |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 // Set the new substituted URL. | 1193 // Set the new substituted URL. |
| 1194 request.setURL(m_delegate->rewriteLayoutTestsURL(request.url().spec())); | 1194 request.setURL(m_delegate->rewriteLayoutTestsURL(request.url().spec())); |
| 1195 } | 1195 } |
| 1196 | 1196 |
| 1197 void WebTestProxyBase::didReceiveResponse(WebFrame*, unsigned identifier, const
blink::WebURLResponse& response) | 1197 void WebTestProxyBase::didReceiveResponse(WebLocalFrame*, unsigned identifier, c
onst blink::WebURLResponse& response) |
| 1198 { | 1198 { |
| 1199 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { | 1199 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { |
| 1200 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) | 1200 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) |
| 1201 m_delegate->printMessage("<unknown>"); | 1201 m_delegate->printMessage("<unknown>"); |
| 1202 else | 1202 else |
| 1203 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); | 1203 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); |
| 1204 m_delegate->printMessage(" - didReceiveResponse "); | 1204 m_delegate->printMessage(" - didReceiveResponse "); |
| 1205 printResponseDescription(m_delegate, response); | 1205 printResponseDescription(m_delegate, response); |
| 1206 m_delegate->printMessage("\n"); | 1206 m_delegate->printMessage("\n"); |
| 1207 } | 1207 } |
| 1208 if (m_testInterfaces->testRunner()->shouldDumpResourceResponseMIMETypes()) { | 1208 if (m_testInterfaces->testRunner()->shouldDumpResourceResponseMIMETypes()) { |
| 1209 GURL url = response.url(); | 1209 GURL url = response.url(); |
| 1210 WebString mimeType = response.mimeType(); | 1210 WebString mimeType = response.mimeType(); |
| 1211 m_delegate->printMessage(url.ExtractFileName()); | 1211 m_delegate->printMessage(url.ExtractFileName()); |
| 1212 m_delegate->printMessage(" has MIME type "); | 1212 m_delegate->printMessage(" has MIME type "); |
| 1213 // Simulate NSURLResponse's mapping of empty/unknown MIME types to appli
cation/octet-stream | 1213 // Simulate NSURLResponse's mapping of empty/unknown MIME types to appli
cation/octet-stream |
| 1214 m_delegate->printMessage(mimeType.isEmpty() ? "application/octet-stream"
: mimeType.utf8().data()); | 1214 m_delegate->printMessage(mimeType.isEmpty() ? "application/octet-stream"
: mimeType.utf8().data()); |
| 1215 m_delegate->printMessage("\n"); | 1215 m_delegate->printMessage("\n"); |
| 1216 } | 1216 } |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 void WebTestProxyBase::didChangeResourcePriority(WebFrame*, unsigned identifier,
const blink::WebURLRequest::Priority& priority) | 1219 void WebTestProxyBase::didChangeResourcePriority(WebLocalFrame*, unsigned identi
fier, const blink::WebURLRequest::Priority& priority) |
| 1220 { | 1220 { |
| 1221 if (m_testInterfaces->testRunner()->shouldDumpResourcePriorities()) { | 1221 if (m_testInterfaces->testRunner()->shouldDumpResourcePriorities()) { |
| 1222 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) | 1222 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) |
| 1223 m_delegate->printMessage("<unknown>"); | 1223 m_delegate->printMessage("<unknown>"); |
| 1224 else | 1224 else |
| 1225 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); | 1225 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); |
| 1226 m_delegate->printMessage(" changed priority to "); | 1226 m_delegate->printMessage(" changed priority to "); |
| 1227 m_delegate->printMessage(PriorityDescription(priority)); | 1227 m_delegate->printMessage(PriorityDescription(priority)); |
| 1228 m_delegate->printMessage("\n"); | 1228 m_delegate->printMessage("\n"); |
| 1229 } | 1229 } |
| 1230 } | 1230 } |
| 1231 | 1231 |
| 1232 void WebTestProxyBase::didFinishResourceLoad(WebFrame*, unsigned identifier) | 1232 void WebTestProxyBase::didFinishResourceLoad(WebLocalFrame*, unsigned identifier
) |
| 1233 { | 1233 { |
| 1234 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { | 1234 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { |
| 1235 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) | 1235 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) |
| 1236 m_delegate->printMessage("<unknown>"); | 1236 m_delegate->printMessage("<unknown>"); |
| 1237 else | 1237 else |
| 1238 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); | 1238 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); |
| 1239 m_delegate->printMessage(" - didFinishLoading\n"); | 1239 m_delegate->printMessage(" - didFinishLoading\n"); |
| 1240 } | 1240 } |
| 1241 m_resourceIdentifierMap.erase(identifier); | 1241 m_resourceIdentifierMap.erase(identifier); |
| 1242 } | 1242 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 size_t fileProtocol = newMessage.find("file://"); | 1276 size_t fileProtocol = newMessage.find("file://"); |
| 1277 if (fileProtocol != string::npos) { | 1277 if (fileProtocol != string::npos) { |
| 1278 newMessage = newMessage.substr(0, fileProtocol) | 1278 newMessage = newMessage.substr(0, fileProtocol) |
| 1279 + urlSuitableForTestResult(newMessage.substr(fileProtocol)); | 1279 + urlSuitableForTestResult(newMessage.substr(fileProtocol)); |
| 1280 } | 1280 } |
| 1281 m_delegate->printMessage(newMessage); | 1281 m_delegate->printMessage(newMessage); |
| 1282 } | 1282 } |
| 1283 m_delegate->printMessage(string("\n")); | 1283 m_delegate->printMessage(string("\n")); |
| 1284 } | 1284 } |
| 1285 | 1285 |
| 1286 void WebTestProxyBase::runModalAlertDialog(WebFrame*, const WebString& message) | 1286 void WebTestProxyBase::runModalAlertDialog(WebLocalFrame*, const WebString& mess
age) |
| 1287 { | 1287 { |
| 1288 m_delegate->printMessage(string("ALERT: ") + message.utf8().data() + "\n"); | 1288 m_delegate->printMessage(string("ALERT: ") + message.utf8().data() + "\n"); |
| 1289 } | 1289 } |
| 1290 | 1290 |
| 1291 bool WebTestProxyBase::runModalConfirmDialog(WebFrame*, const WebString& message
) | 1291 bool WebTestProxyBase::runModalConfirmDialog(WebLocalFrame*, const WebString& me
ssage) |
| 1292 { | 1292 { |
| 1293 m_delegate->printMessage(string("CONFIRM: ") + message.utf8().data() + "\n")
; | 1293 m_delegate->printMessage(string("CONFIRM: ") + message.utf8().data() + "\n")
; |
| 1294 return true; | 1294 return true; |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 bool WebTestProxyBase::runModalPromptDialog(WebFrame* frame, const WebString& me
ssage, const WebString& defaultValue, WebString*) | 1297 bool WebTestProxyBase::runModalPromptDialog(WebLocalFrame* frame, const WebStrin
g& message, const WebString& defaultValue, WebString*) |
| 1298 { | 1298 { |
| 1299 m_delegate->printMessage(string("PROMPT: ") + message.utf8().data() + ", def
ault text: " + defaultValue.utf8().data() + "\n"); | 1299 m_delegate->printMessage(string("PROMPT: ") + message.utf8().data() + ", def
ault text: " + defaultValue.utf8().data() + "\n"); |
| 1300 return true; | 1300 return true; |
| 1301 } | 1301 } |
| 1302 | 1302 |
| 1303 bool WebTestProxyBase::runModalBeforeUnloadDialog(WebFrame*, const WebString& me
ssage) | 1303 bool WebTestProxyBase::runModalBeforeUnloadDialog(WebLocalFrame*, const WebStrin
g& message) |
| 1304 { | 1304 { |
| 1305 m_delegate->printMessage(string("CONFIRM NAVIGATION: ") + message.utf8().dat
a() + "\n"); | 1305 m_delegate->printMessage(string("CONFIRM NAVIGATION: ") + message.utf8().dat
a() + "\n"); |
| 1306 return !m_testInterfaces->testRunner()->shouldStayOnPageAfterHandlingBeforeU
nload(); | 1306 return !m_testInterfaces->testRunner()->shouldStayOnPageAfterHandlingBeforeU
nload(); |
| 1307 } | 1307 } |
| 1308 | 1308 |
| 1309 void WebTestProxyBase::locationChangeDone(WebFrame* frame) | 1309 void WebTestProxyBase::locationChangeDone(WebFrame* frame) |
| 1310 { | 1310 { |
| 1311 if (frame != m_testInterfaces->testRunner()->topLoadingFrame()) | 1311 if (frame != m_testInterfaces->testRunner()->topLoadingFrame()) |
| 1312 return; | 1312 return; |
| 1313 m_testInterfaces->testRunner()->setTopLoadingFrame(frame, true); | 1313 m_testInterfaces->testRunner()->setTopLoadingFrame(frame, true); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 WebNavigationPolicy WebTestProxyBase::decidePolicyForNavigation(WebFrame*, WebDa
taSource::ExtraData*, const WebURLRequest& request, WebNavigationType type, WebN
avigationPolicy defaultPolicy, bool isRedirect) | 1316 WebNavigationPolicy WebTestProxyBase::decidePolicyForNavigation(WebLocalFrame*,
WebDataSource::ExtraData*, const WebURLRequest& request, WebNavigationType type,
WebNavigationPolicy defaultPolicy, bool isRedirect) |
| 1317 { | 1317 { |
| 1318 WebNavigationPolicy result; | 1318 WebNavigationPolicy result; |
| 1319 if (!m_testInterfaces->testRunner()->policyDelegateEnabled()) | 1319 if (!m_testInterfaces->testRunner()->policyDelegateEnabled()) |
| 1320 return defaultPolicy; | 1320 return defaultPolicy; |
| 1321 | 1321 |
| 1322 m_delegate->printMessage(string("Policy delegate: attempt to load ") + URLDe
scription(request.url()) + " with navigation type '" + webNavigationTypeToString
(type) + "'\n"); | 1322 m_delegate->printMessage(string("Policy delegate: attempt to load ") + URLDe
scription(request.url()) + " with navigation type '" + webNavigationTypeToString
(type) + "'\n"); |
| 1323 if (m_testInterfaces->testRunner()->policyDelegateIsPermissive()) | 1323 if (m_testInterfaces->testRunner()->policyDelegateIsPermissive()) |
| 1324 result = blink::WebNavigationPolicyCurrentTab; | 1324 result = blink::WebNavigationPolicyCurrentTab; |
| 1325 else | 1325 else |
| 1326 result = blink::WebNavigationPolicyIgnore; | 1326 result = blink::WebNavigationPolicyIgnore; |
| 1327 | 1327 |
| 1328 if (m_testInterfaces->testRunner()->policyDelegateShouldNotifyDone()) | 1328 if (m_testInterfaces->testRunner()->policyDelegateShouldNotifyDone()) |
| 1329 m_testInterfaces->testRunner()->policyDelegateDone(); | 1329 m_testInterfaces->testRunner()->policyDelegateDone(); |
| 1330 return result; | 1330 return result; |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 bool WebTestProxyBase::willCheckAndDispatchMessageEvent(WebFrame*, WebFrame*, We
bSecurityOrigin, WebDOMMessageEvent) | 1333 bool WebTestProxyBase::willCheckAndDispatchMessageEvent(WebLocalFrame*, WebFrame
*, WebSecurityOrigin, WebDOMMessageEvent) |
| 1334 { | 1334 { |
| 1335 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { | 1335 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { |
| 1336 m_delegate->printMessage("intercepted postMessage\n"); | 1336 m_delegate->printMessage("intercepted postMessage\n"); |
| 1337 return true; | 1337 return true; |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 return false; | 1340 return false; |
| 1341 } | 1341 } |
| 1342 | 1342 |
| 1343 void WebTestProxyBase::postSpellCheckEvent(const WebString& eventName) | 1343 void WebTestProxyBase::postSpellCheckEvent(const WebString& eventName) |
| 1344 { | 1344 { |
| 1345 if (m_testInterfaces->testRunner()->shouldDumpSpellCheckCallbacks()) { | 1345 if (m_testInterfaces->testRunner()->shouldDumpSpellCheckCallbacks()) { |
| 1346 m_delegate->printMessage(string("SpellCheckEvent: ") + eventName.utf8().
data() + "\n"); | 1346 m_delegate->printMessage(string("SpellCheckEvent: ") + eventName.utf8().
data() + "\n"); |
| 1347 } | 1347 } |
| 1348 } | 1348 } |
| 1349 | 1349 |
| 1350 void WebTestProxyBase::resetInputMethod() | 1350 void WebTestProxyBase::resetInputMethod() |
| 1351 { | 1351 { |
| 1352 // If a composition text exists, then we need to let the browser process | 1352 // If a composition text exists, then we need to let the browser process |
| 1353 // to cancel the input method's ongoing composition session. | 1353 // to cancel the input method's ongoing composition session. |
| 1354 if (m_webWidget) | 1354 if (m_webWidget) |
| 1355 m_webWidget->confirmComposition(); | 1355 m_webWidget->confirmComposition(); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 } | 1358 } |
| OLD | NEW |