| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "public/web/WebPrintParams.h" | 65 #include "public/web/WebPrintParams.h" |
| 66 #include "public/web/WebRange.h" | 66 #include "public/web/WebRange.h" |
| 67 #include "public/web/WebScriptController.h" | 67 #include "public/web/WebScriptController.h" |
| 68 #include "public/web/WebUserGestureIndicator.h" | 68 #include "public/web/WebUserGestureIndicator.h" |
| 69 #include "public/web/WebView.h" | 69 #include "public/web/WebView.h" |
| 70 | 70 |
| 71 // FIXME: Including platform_canvas.h here is a layering violation. | 71 // FIXME: Including platform_canvas.h here is a layering violation. |
| 72 #include <cctype> | 72 #include <cctype> |
| 73 #include "skia/ext/platform_canvas.h" | 73 #include "skia/ext/platform_canvas.h" |
| 74 | 74 |
| 75 using namespace WebKit; | 75 using namespace blink; |
| 76 using namespace std; | 76 using namespace std; |
| 77 | 77 |
| 78 namespace WebTestRunner { | 78 namespace WebTestRunner { |
| 79 | 79 |
| 80 namespace { | 80 namespace { |
| 81 | 81 |
| 82 class HostMethodTask : public WebMethodTask<WebTestProxyBase> { | 82 class HostMethodTask : public WebMethodTask<WebTestProxyBase> { |
| 83 public: | 83 public: |
| 84 typedef void (WebTestProxyBase::*CallbackMethodType)(); | 84 typedef void (WebTestProxyBase::*CallbackMethodType)(); |
| 85 HostMethodTask(WebTestProxyBase* object, CallbackMethodType callback) | 85 HostMethodTask(WebTestProxyBase* object, CallbackMethodType callback) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 printNodeDescription(delegate, startNode, exception); | 125 printNodeDescription(delegate, startNode, exception); |
| 126 snprintf(buffer, sizeof(buffer), " to %d of ", range.endOffset()); | 126 snprintf(buffer, sizeof(buffer), " to %d of ", range.endOffset()); |
| 127 delegate->printMessage(buffer); | 127 delegate->printMessage(buffer); |
| 128 WebNode endNode = range.endContainer(exception); | 128 WebNode endNode = range.endContainer(exception); |
| 129 printNodeDescription(delegate, endNode, exception); | 129 printNodeDescription(delegate, endNode, exception); |
| 130 } | 130 } |
| 131 | 131 |
| 132 string textAffinityDescription(WebTextAffinity affinity) | 132 string textAffinityDescription(WebTextAffinity affinity) |
| 133 { | 133 { |
| 134 switch (affinity) { | 134 switch (affinity) { |
| 135 case WebKit::WebTextAffinityUpstream: | 135 case blink::WebTextAffinityUpstream: |
| 136 return "NSSelectionAffinityUpstream"; | 136 return "NSSelectionAffinityUpstream"; |
| 137 case WebKit::WebTextAffinityDownstream: | 137 case blink::WebTextAffinityDownstream: |
| 138 return "NSSelectionAffinityDownstream"; | 138 return "NSSelectionAffinityDownstream"; |
| 139 } | 139 } |
| 140 return "(UNKNOWN AFFINITY)"; | 140 return "(UNKNOWN AFFINITY)"; |
| 141 } | 141 } |
| 142 | 142 |
| 143 void printFrameDescription(WebTestDelegate* delegate, WebFrame* frame) | 143 void printFrameDescription(WebTestDelegate* delegate, WebFrame* frame) |
| 144 { | 144 { |
| 145 string name8 = frame->uniqueName().utf8(); | 145 string name8 = frame->uniqueName().utf8(); |
| 146 if (frame == frame->view()->mainFrame()) { | 146 if (frame == frame->view()->mainFrame()) { |
| 147 if (!name8.length()) { | 147 if (!name8.length()) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 const char* backForwardString = "back/forward"; | 264 const char* backForwardString = "back/forward"; |
| 265 const char* reloadString = "reload"; | 265 const char* reloadString = "reload"; |
| 266 const char* formResubmittedString = "form resubmitted"; | 266 const char* formResubmittedString = "form resubmitted"; |
| 267 const char* otherString = "other"; | 267 const char* otherString = "other"; |
| 268 const char* illegalString = "illegal value"; | 268 const char* illegalString = "illegal value"; |
| 269 | 269 |
| 270 // Get a debugging string from a WebNavigationType. | 270 // Get a debugging string from a WebNavigationType. |
| 271 const char* webNavigationTypeToString(WebNavigationType type) | 271 const char* webNavigationTypeToString(WebNavigationType type) |
| 272 { | 272 { |
| 273 switch (type) { | 273 switch (type) { |
| 274 case WebKit::WebNavigationTypeLinkClicked: | 274 case blink::WebNavigationTypeLinkClicked: |
| 275 return linkClickedString; | 275 return linkClickedString; |
| 276 case WebKit::WebNavigationTypeFormSubmitted: | 276 case blink::WebNavigationTypeFormSubmitted: |
| 277 return formSubmittedString; | 277 return formSubmittedString; |
| 278 case WebKit::WebNavigationTypeBackForward: | 278 case blink::WebNavigationTypeBackForward: |
| 279 return backForwardString; | 279 return backForwardString; |
| 280 case WebKit::WebNavigationTypeReload: | 280 case blink::WebNavigationTypeReload: |
| 281 return reloadString; | 281 return reloadString; |
| 282 case WebKit::WebNavigationTypeFormResubmitted: | 282 case blink::WebNavigationTypeFormResubmitted: |
| 283 return formResubmittedString; | 283 return formResubmittedString; |
| 284 case WebKit::WebNavigationTypeOther: | 284 case blink::WebNavigationTypeOther: |
| 285 return otherString; | 285 return otherString; |
| 286 } | 286 } |
| 287 return illegalString; | 287 return illegalString; |
| 288 } | 288 } |
| 289 | 289 |
| 290 string dumpDocumentText(WebFrame* frame) | 290 string dumpDocumentText(WebFrame* frame) |
| 291 { | 291 { |
| 292 // We use the document element's text instead of the body text here because | 292 // We use the document element's text instead of the body text here because |
| 293 // not all documents have a body, such as XML documents. | 293 // not all documents have a body, such as XML documents. |
| 294 WebElement documentElement = frame->document().documentElement(); | 294 WebElement documentElement = frame->document().documentElement(); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 WebSpellCheckClient* WebTestProxyBase::spellCheckClient() const | 515 WebSpellCheckClient* WebTestProxyBase::spellCheckClient() const |
| 516 { | 516 { |
| 517 return m_spellcheck.get(); | 517 return m_spellcheck.get(); |
| 518 } | 518 } |
| 519 | 519 |
| 520 WebValidationMessageClient* WebTestProxyBase::validationMessageClient() | 520 WebValidationMessageClient* WebTestProxyBase::validationMessageClient() |
| 521 { | 521 { |
| 522 return m_validationMessageClient.get(); | 522 return m_validationMessageClient.get(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 WebColorChooser* WebTestProxyBase::createColorChooser(WebColorChooserClient* cli
ent, const WebKit::WebColor& color) | 525 WebColorChooser* WebTestProxyBase::createColorChooser(WebColorChooserClient* cli
ent, const blink::WebColor& color) |
| 526 { | 526 { |
| 527 // This instance is deleted by WebCore::ColorInputType | 527 // This instance is deleted by WebCore::ColorInputType |
| 528 return new MockColorChooser(client, m_delegate, this); | 528 return new MockColorChooser(client, m_delegate, this); |
| 529 } | 529 } |
| 530 | 530 |
| 531 bool WebTestProxyBase::runFileChooser(const WebKit::WebFileChooserParams&, WebKi
t::WebFileChooserCompletion*) | 531 bool WebTestProxyBase::runFileChooser(const blink::WebFileChooserParams&, blink:
:WebFileChooserCompletion*) |
| 532 { | 532 { |
| 533 m_delegate->printMessage("Mock: Opening a file chooser.\n"); | 533 m_delegate->printMessage("Mock: Opening a file chooser.\n"); |
| 534 // FIXME: Add ability to set file names to a file upload control. | 534 // FIXME: Add ability to set file names to a file upload control. |
| 535 return false; | 535 return false; |
| 536 } | 536 } |
| 537 | 537 |
| 538 string WebTestProxyBase::captureTree(bool debugRenderTree) | 538 string WebTestProxyBase::captureTree(bool debugRenderTree) |
| 539 { | 539 { |
| 540 WebScriptController::flushConsoleMessages(); | 540 WebScriptController::flushConsoleMessages(); |
| 541 | 541 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 // Paints the entire canvas a semi-transparent black (grayish). This is used | 701 // Paints the entire canvas a semi-transparent black (grayish). This is used |
| 702 // by the layout tests in fast/repaint. The alpha value matches upstream. | 702 // by the layout tests in fast/repaint. The alpha value matches upstream. |
| 703 void WebTestProxyBase::displayRepaintMask() | 703 void WebTestProxyBase::displayRepaintMask() |
| 704 { | 704 { |
| 705 canvas()->drawARGB(167, 0, 0, 0); | 705 canvas()->drawARGB(167, 0, 0, 0); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void WebTestProxyBase::display() | 708 void WebTestProxyBase::display() |
| 709 { | 709 { |
| 710 const WebKit::WebSize& size = webWidget()->size(); | 710 const blink::WebSize& size = webWidget()->size(); |
| 711 WebRect rect(0, 0, size.width, size.height); | 711 WebRect rect(0, 0, size.width, size.height); |
| 712 m_paintRect = rect; | 712 m_paintRect = rect; |
| 713 paintInvalidatedRegion(); | 713 paintInvalidatedRegion(); |
| 714 displayRepaintMask(); | 714 displayRepaintMask(); |
| 715 } | 715 } |
| 716 | 716 |
| 717 void WebTestProxyBase::displayInvalidatedRegion() | 717 void WebTestProxyBase::displayInvalidatedRegion() |
| 718 { | 718 { |
| 719 paintInvalidatedRegion(); | 719 paintInvalidatedRegion(); |
| 720 displayRepaintMask(); | 720 displayRepaintMask(); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 { | 815 { |
| 816 invalidateAll(); | 816 invalidateAll(); |
| 817 discardBackingStore(); | 817 discardBackingStore(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 void WebTestProxyBase::didAutoResize(const WebSize&) | 820 void WebTestProxyBase::didAutoResize(const WebSize&) |
| 821 { | 821 { |
| 822 invalidateAll(); | 822 invalidateAll(); |
| 823 } | 823 } |
| 824 | 824 |
| 825 void WebTestProxyBase::postAccessibilityEvent(const WebKit::WebAXObject& obj, We
bKit::WebAXEvent event) | 825 void WebTestProxyBase::postAccessibilityEvent(const blink::WebAXObject& obj, bli
nk::WebAXEvent event) |
| 826 { | 826 { |
| 827 if (event == WebKit::WebAXEventFocus) | 827 if (event == blink::WebAXEventFocus) |
| 828 m_testInterfaces->accessibilityController()->setFocusedElement(obj); | 828 m_testInterfaces->accessibilityController()->setFocusedElement(obj); |
| 829 | 829 |
| 830 const char* eventName = 0; | 830 const char* eventName = 0; |
| 831 switch (event) { | 831 switch (event) { |
| 832 case WebKit::WebAXEventActiveDescendantChanged: | 832 case blink::WebAXEventActiveDescendantChanged: |
| 833 eventName = "ActiveDescendantChanged"; | 833 eventName = "ActiveDescendantChanged"; |
| 834 break; | 834 break; |
| 835 case WebKit::WebAXEventAlert: | 835 case blink::WebAXEventAlert: |
| 836 eventName = "Alert"; | 836 eventName = "Alert"; |
| 837 break; | 837 break; |
| 838 case WebKit::WebAXEventAriaAttributeChanged: | 838 case blink::WebAXEventAriaAttributeChanged: |
| 839 eventName = "AriaAttributeChanged"; | 839 eventName = "AriaAttributeChanged"; |
| 840 break; | 840 break; |
| 841 case WebKit::WebAXEventAutocorrectionOccured: | 841 case blink::WebAXEventAutocorrectionOccured: |
| 842 eventName = "AutocorrectionOccured"; | 842 eventName = "AutocorrectionOccured"; |
| 843 break; | 843 break; |
| 844 case WebKit::WebAXEventBlur: | 844 case blink::WebAXEventBlur: |
| 845 eventName = "Blur"; | 845 eventName = "Blur"; |
| 846 break; | 846 break; |
| 847 case WebKit::WebAXEventCheckedStateChanged: | 847 case blink::WebAXEventCheckedStateChanged: |
| 848 eventName = "CheckedStateChanged"; | 848 eventName = "CheckedStateChanged"; |
| 849 break; | 849 break; |
| 850 case WebKit::WebAXEventChildrenChanged: | 850 case blink::WebAXEventChildrenChanged: |
| 851 eventName = "ChildrenChanged"; | 851 eventName = "ChildrenChanged"; |
| 852 break; | 852 break; |
| 853 case WebKit::WebAXEventFocus: | 853 case blink::WebAXEventFocus: |
| 854 eventName = "Focus"; | 854 eventName = "Focus"; |
| 855 break; | 855 break; |
| 856 case WebKit::WebAXEventHide: | 856 case blink::WebAXEventHide: |
| 857 eventName = "Hide"; | 857 eventName = "Hide"; |
| 858 break; | 858 break; |
| 859 case WebKit::WebAXEventInvalidStatusChanged: | 859 case blink::WebAXEventInvalidStatusChanged: |
| 860 eventName = "InvalidStatusChanged"; | 860 eventName = "InvalidStatusChanged"; |
| 861 break; | 861 break; |
| 862 case WebKit::WebAXEventLayoutComplete: | 862 case blink::WebAXEventLayoutComplete: |
| 863 eventName = "LayoutComplete"; | 863 eventName = "LayoutComplete"; |
| 864 break; | 864 break; |
| 865 case WebKit::WebAXEventLiveRegionChanged: | 865 case blink::WebAXEventLiveRegionChanged: |
| 866 eventName = "LiveRegionChanged"; | 866 eventName = "LiveRegionChanged"; |
| 867 break; | 867 break; |
| 868 case WebKit::WebAXEventLoadComplete: | 868 case blink::WebAXEventLoadComplete: |
| 869 eventName = "LoadComplete"; | 869 eventName = "LoadComplete"; |
| 870 break; | 870 break; |
| 871 case WebKit::WebAXEventLocationChanged: | 871 case blink::WebAXEventLocationChanged: |
| 872 eventName = "LocationChanged"; | 872 eventName = "LocationChanged"; |
| 873 break; | 873 break; |
| 874 case WebKit::WebAXEventMenuListItemSelected: | 874 case blink::WebAXEventMenuListItemSelected: |
| 875 eventName = "MenuListItemSelected"; | 875 eventName = "MenuListItemSelected"; |
| 876 break; | 876 break; |
| 877 case WebKit::WebAXEventMenuListValueChanged: | 877 case blink::WebAXEventMenuListValueChanged: |
| 878 eventName = "MenuListValueChanged"; | 878 eventName = "MenuListValueChanged"; |
| 879 break; | 879 break; |
| 880 case WebKit::WebAXEventRowCollapsed: | 880 case blink::WebAXEventRowCollapsed: |
| 881 eventName = "RowCollapsed"; | 881 eventName = "RowCollapsed"; |
| 882 break; | 882 break; |
| 883 case WebKit::WebAXEventRowCountChanged: | 883 case blink::WebAXEventRowCountChanged: |
| 884 eventName = "RowCountChanged"; | 884 eventName = "RowCountChanged"; |
| 885 break; | 885 break; |
| 886 case WebKit::WebAXEventRowExpanded: | 886 case blink::WebAXEventRowExpanded: |
| 887 eventName = "RowExpanded"; | 887 eventName = "RowExpanded"; |
| 888 break; | 888 break; |
| 889 case WebKit::WebAXEventScrolledToAnchor: | 889 case blink::WebAXEventScrolledToAnchor: |
| 890 eventName = "ScrolledToAnchor"; | 890 eventName = "ScrolledToAnchor"; |
| 891 break; | 891 break; |
| 892 case WebKit::WebAXEventSelectedChildrenChanged: | 892 case blink::WebAXEventSelectedChildrenChanged: |
| 893 eventName = "SelectedChildrenChanged"; | 893 eventName = "SelectedChildrenChanged"; |
| 894 break; | 894 break; |
| 895 case WebKit::WebAXEventSelectedTextChanged: | 895 case blink::WebAXEventSelectedTextChanged: |
| 896 eventName = "SelectedTextChanged"; | 896 eventName = "SelectedTextChanged"; |
| 897 break; | 897 break; |
| 898 case WebKit::WebAXEventShow: | 898 case blink::WebAXEventShow: |
| 899 eventName = "Show"; | 899 eventName = "Show"; |
| 900 break; | 900 break; |
| 901 case WebKit::WebAXEventTextChanged: | 901 case blink::WebAXEventTextChanged: |
| 902 eventName = "TextChanged"; | 902 eventName = "TextChanged"; |
| 903 break; | 903 break; |
| 904 case WebKit::WebAXEventTextInserted: | 904 case blink::WebAXEventTextInserted: |
| 905 eventName = "TextInserted"; | 905 eventName = "TextInserted"; |
| 906 break; | 906 break; |
| 907 case WebKit::WebAXEventTextRemoved: | 907 case blink::WebAXEventTextRemoved: |
| 908 eventName = "TextRemoved"; | 908 eventName = "TextRemoved"; |
| 909 break; | 909 break; |
| 910 case WebKit::WebAXEventValueChanged: | 910 case blink::WebAXEventValueChanged: |
| 911 eventName = "ValueChanged"; | 911 eventName = "ValueChanged"; |
| 912 break; | 912 break; |
| 913 } | 913 } |
| 914 | 914 |
| 915 m_testInterfaces->accessibilityController()->notificationReceived(obj, event
Name); | 915 m_testInterfaces->accessibilityController()->notificationReceived(obj, event
Name); |
| 916 | 916 |
| 917 if (m_testInterfaces->accessibilityController()->shouldLogAccessibilityEvent
s()) { | 917 if (m_testInterfaces->accessibilityController()->shouldLogAccessibilityEvent
s()) { |
| 918 string message("AccessibilityNotification - "); | 918 string message("AccessibilityNotification - "); |
| 919 message += eventName; | 919 message += eventName; |
| 920 | 920 |
| 921 WebKit::WebNode node = obj.node(); | 921 blink::WebNode node = obj.node(); |
| 922 if (!node.isNull() && node.isElementNode()) { | 922 if (!node.isNull() && node.isElementNode()) { |
| 923 WebKit::WebElement element = node.to<WebKit::WebElement>(); | 923 blink::WebElement element = node.to<blink::WebElement>(); |
| 924 if (element.hasAttribute("id")) { | 924 if (element.hasAttribute("id")) { |
| 925 message += " - id:"; | 925 message += " - id:"; |
| 926 message += element.getAttribute("id").utf8().data(); | 926 message += element.getAttribute("id").utf8().data(); |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 | 929 |
| 930 m_delegate->printMessage(message + "\n"); | 930 m_delegate->printMessage(message + "\n"); |
| 931 } | 931 } |
| 932 } | 932 } |
| 933 | 933 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) | 1192 if (m_testInterfaces->testRunner()->shouldDumpFrameLoadCallbacks()) |
| 1193 m_delegate->printMessage("didDetectXSS\n"); | 1193 m_delegate->printMessage("didDetectXSS\n"); |
| 1194 } | 1194 } |
| 1195 | 1195 |
| 1196 void WebTestProxyBase::didDispatchPingLoader(WebFrame*, const WebURL& url) | 1196 void WebTestProxyBase::didDispatchPingLoader(WebFrame*, const WebURL& url) |
| 1197 { | 1197 { |
| 1198 if (m_testInterfaces->testRunner()->shouldDumpPingLoaderCallbacks()) | 1198 if (m_testInterfaces->testRunner()->shouldDumpPingLoaderCallbacks()) |
| 1199 m_delegate->printMessage(string("PingLoader dispatched to '") + URLDescr
iption(url).c_str() + "'.\n"); | 1199 m_delegate->printMessage(string("PingLoader dispatched to '") + URLDescr
iption(url).c_str() + "'.\n"); |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 void WebTestProxyBase::willRequestResource(WebFrame* frame, const WebKit::WebCac
hedURLRequest& request) | 1202 void WebTestProxyBase::willRequestResource(WebFrame* frame, const blink::WebCach
edURLRequest& request) |
| 1203 { | 1203 { |
| 1204 if (m_testInterfaces->testRunner()->shouldDumpResourceRequestCallbacks()) { | 1204 if (m_testInterfaces->testRunner()->shouldDumpResourceRequestCallbacks()) { |
| 1205 printFrameDescription(m_delegate, frame); | 1205 printFrameDescription(m_delegate, frame); |
| 1206 m_delegate->printMessage(string(" - ") + request.initiatorName().utf8().
data()); | 1206 m_delegate->printMessage(string(" - ") + request.initiatorName().utf8().
data()); |
| 1207 m_delegate->printMessage(string(" requested '") + URLDescription(request
.urlRequest().url()).c_str() + "'\n"); | 1207 m_delegate->printMessage(string(" requested '") + URLDescription(request
.urlRequest().url()).c_str() + "'\n"); |
| 1208 } | 1208 } |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 void WebTestProxyBase::didCreateDataSource(WebFrame*, WebDataSource* ds) | 1211 void WebTestProxyBase::didCreateDataSource(WebFrame*, WebDataSource* ds) |
| 1212 { | 1212 { |
| 1213 if (!m_testInterfaces->testRunner()->deferMainResourceDataLoad()) | 1213 if (!m_testInterfaces->testRunner()->deferMainResourceDataLoad()) |
| 1214 ds->setDeferMainResourceDataLoad(false); | 1214 ds->setDeferMainResourceDataLoad(false); |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, WebKit::W
ebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) | 1217 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, blink::We
bURLRequest& request, const blink::WebURLResponse& redirectResponse) |
| 1218 { | 1218 { |
| 1219 // Need to use GURL for host() and SchemeIs() | 1219 // Need to use GURL for host() and SchemeIs() |
| 1220 GURL url = request.url(); | 1220 GURL url = request.url(); |
| 1221 string requestURL = url.possibly_invalid_spec(); | 1221 string requestURL = url.possibly_invalid_spec(); |
| 1222 | 1222 |
| 1223 GURL mainDocumentURL = request.firstPartyForCookies(); | 1223 GURL mainDocumentURL = request.firstPartyForCookies(); |
| 1224 | 1224 |
| 1225 if (redirectResponse.isNull() && (m_testInterfaces->testRunner()->shouldDump
ResourceLoadCallbacks() || m_testInterfaces->testRunner()->shouldDumpResourcePri
orities())) { | 1225 if (redirectResponse.isNull() && (m_testInterfaces->testRunner()->shouldDump
ResourceLoadCallbacks() || m_testInterfaces->testRunner()->shouldDumpResourcePri
orities())) { |
| 1226 BLINK_ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdent
ifierMap.end()); | 1226 BLINK_ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdent
ifierMap.end()); |
| 1227 m_resourceIdentifierMap[identifier] = descriptionSuitableForTestResult(r
equestURL); | 1227 m_resourceIdentifierMap[identifier] = descriptionSuitableForTestResult(r
equestURL); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 m_delegate->printMessage(string("Blocked access to external URL ") +
requestURL + "\n"); | 1264 m_delegate->printMessage(string("Blocked access to external URL ") +
requestURL + "\n"); |
| 1265 blockRequest(request); | 1265 blockRequest(request); |
| 1266 return; | 1266 return; |
| 1267 } | 1267 } |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 // Set the new substituted URL. | 1270 // Set the new substituted URL. |
| 1271 request.setURL(m_delegate->rewriteLayoutTestsURL(request.url().spec())); | 1271 request.setURL(m_delegate->rewriteLayoutTestsURL(request.url().spec())); |
| 1272 } | 1272 } |
| 1273 | 1273 |
| 1274 void WebTestProxyBase::didReceiveResponse(WebFrame*, unsigned identifier, const
WebKit::WebURLResponse& response) | 1274 void WebTestProxyBase::didReceiveResponse(WebFrame*, unsigned identifier, const
blink::WebURLResponse& response) |
| 1275 { | 1275 { |
| 1276 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { | 1276 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { |
| 1277 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) | 1277 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) |
| 1278 m_delegate->printMessage("<unknown>"); | 1278 m_delegate->printMessage("<unknown>"); |
| 1279 else | 1279 else |
| 1280 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); | 1280 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); |
| 1281 m_delegate->printMessage(" - didReceiveResponse "); | 1281 m_delegate->printMessage(" - didReceiveResponse "); |
| 1282 printResponseDescription(m_delegate, response); | 1282 printResponseDescription(m_delegate, response); |
| 1283 m_delegate->printMessage("\n"); | 1283 m_delegate->printMessage("\n"); |
| 1284 } | 1284 } |
| 1285 if (m_testInterfaces->testRunner()->shouldDumpResourceResponseMIMETypes()) { | 1285 if (m_testInterfaces->testRunner()->shouldDumpResourceResponseMIMETypes()) { |
| 1286 GURL url = response.url(); | 1286 GURL url = response.url(); |
| 1287 WebString mimeType = response.mimeType(); | 1287 WebString mimeType = response.mimeType(); |
| 1288 m_delegate->printMessage(url.ExtractFileName()); | 1288 m_delegate->printMessage(url.ExtractFileName()); |
| 1289 m_delegate->printMessage(" has MIME type "); | 1289 m_delegate->printMessage(" has MIME type "); |
| 1290 // Simulate NSURLResponse's mapping of empty/unknown MIME types to appli
cation/octet-stream | 1290 // Simulate NSURLResponse's mapping of empty/unknown MIME types to appli
cation/octet-stream |
| 1291 m_delegate->printMessage(mimeType.isEmpty() ? "application/octet-stream"
: mimeType.utf8().data()); | 1291 m_delegate->printMessage(mimeType.isEmpty() ? "application/octet-stream"
: mimeType.utf8().data()); |
| 1292 m_delegate->printMessage("\n"); | 1292 m_delegate->printMessage("\n"); |
| 1293 } | 1293 } |
| 1294 } | 1294 } |
| 1295 | 1295 |
| 1296 void WebTestProxyBase::didChangeResourcePriority(WebFrame*, unsigned identifier,
const WebKit::WebURLRequest::Priority& priority) | 1296 void WebTestProxyBase::didChangeResourcePriority(WebFrame*, unsigned identifier,
const blink::WebURLRequest::Priority& priority) |
| 1297 { | 1297 { |
| 1298 if (m_testInterfaces->testRunner()->shouldDumpResourcePriorities()) { | 1298 if (m_testInterfaces->testRunner()->shouldDumpResourcePriorities()) { |
| 1299 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) | 1299 if (m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.
end()) |
| 1300 m_delegate->printMessage("<unknown>"); | 1300 m_delegate->printMessage("<unknown>"); |
| 1301 else | 1301 else |
| 1302 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); | 1302 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); |
| 1303 m_delegate->printMessage(" changed priority to "); | 1303 m_delegate->printMessage(" changed priority to "); |
| 1304 m_delegate->printMessage(PriorityDescription(priority)); | 1304 m_delegate->printMessage(PriorityDescription(priority)); |
| 1305 m_delegate->printMessage("\n"); | 1305 m_delegate->printMessage("\n"); |
| 1306 } | 1306 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 } | 1391 } |
| 1392 | 1392 |
| 1393 WebNavigationPolicy WebTestProxyBase::decidePolicyForNavigation(WebFrame*, WebDa
taSource::ExtraData*, const WebURLRequest& request, WebNavigationType type, WebN
avigationPolicy defaultPolicy, bool isRedirect) | 1393 WebNavigationPolicy WebTestProxyBase::decidePolicyForNavigation(WebFrame*, WebDa
taSource::ExtraData*, const WebURLRequest& request, WebNavigationType type, WebN
avigationPolicy defaultPolicy, bool isRedirect) |
| 1394 { | 1394 { |
| 1395 WebNavigationPolicy result; | 1395 WebNavigationPolicy result; |
| 1396 if (!m_testInterfaces->testRunner()->policyDelegateEnabled()) | 1396 if (!m_testInterfaces->testRunner()->policyDelegateEnabled()) |
| 1397 return defaultPolicy; | 1397 return defaultPolicy; |
| 1398 | 1398 |
| 1399 m_delegate->printMessage(string("Policy delegate: attempt to load ") + URLDe
scription(request.url()) + " with navigation type '" + webNavigationTypeToString
(type) + "'\n"); | 1399 m_delegate->printMessage(string("Policy delegate: attempt to load ") + URLDe
scription(request.url()) + " with navigation type '" + webNavigationTypeToString
(type) + "'\n"); |
| 1400 if (m_testInterfaces->testRunner()->policyDelegateIsPermissive()) | 1400 if (m_testInterfaces->testRunner()->policyDelegateIsPermissive()) |
| 1401 result = WebKit::WebNavigationPolicyCurrentTab; | 1401 result = blink::WebNavigationPolicyCurrentTab; |
| 1402 else | 1402 else |
| 1403 result = WebKit::WebNavigationPolicyIgnore; | 1403 result = blink::WebNavigationPolicyIgnore; |
| 1404 | 1404 |
| 1405 if (m_testInterfaces->testRunner()->policyDelegateShouldNotifyDone()) | 1405 if (m_testInterfaces->testRunner()->policyDelegateShouldNotifyDone()) |
| 1406 m_testInterfaces->testRunner()->policyDelegateDone(); | 1406 m_testInterfaces->testRunner()->policyDelegateDone(); |
| 1407 return result; | 1407 return result; |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 bool WebTestProxyBase::willCheckAndDispatchMessageEvent(WebFrame*, WebFrame*, We
bSecurityOrigin, WebDOMMessageEvent) | 1410 bool WebTestProxyBase::willCheckAndDispatchMessageEvent(WebFrame*, WebFrame*, We
bSecurityOrigin, WebDOMMessageEvent) |
| 1411 { | 1411 { |
| 1412 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { | 1412 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { |
| 1413 m_delegate->printMessage("intercepted postMessage\n"); | 1413 m_delegate->printMessage("intercepted postMessage\n"); |
| 1414 return true; | 1414 return true; |
| 1415 } | 1415 } |
| 1416 | 1416 |
| 1417 return false; | 1417 return false; |
| 1418 } | 1418 } |
| 1419 | 1419 |
| 1420 void WebTestProxyBase::resetInputMethod() | 1420 void WebTestProxyBase::resetInputMethod() |
| 1421 { | 1421 { |
| 1422 // If a composition text exists, then we need to let the browser process | 1422 // If a composition text exists, then we need to let the browser process |
| 1423 // to cancel the input method's ongoing composition session. | 1423 // to cancel the input method's ongoing composition session. |
| 1424 if (m_webWidget) | 1424 if (m_webWidget) |
| 1425 m_webWidget->confirmComposition(); | 1425 m_webWidget->confirmComposition(); |
| 1426 } | 1426 } |
| 1427 | 1427 |
| 1428 } | 1428 } |
| OLD | NEW |