| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 20 matching lines...) Expand all Loading... |
| 31 #ifndef WebFrameTestProxy_h | 31 #ifndef WebFrameTestProxy_h |
| 32 #define WebFrameTestProxy_h | 32 #define WebFrameTestProxy_h |
| 33 | 33 |
| 34 #include "WebTestProxy.h" | 34 #include "WebTestProxy.h" |
| 35 | 35 |
| 36 namespace WebTestRunner { | 36 namespace WebTestRunner { |
| 37 | 37 |
| 38 // Templetized wrapper around RenderFrameImpl objects, which implement | 38 // Templetized wrapper around RenderFrameImpl objects, which implement |
| 39 // the WebFrameClient interface. | 39 // the WebFrameClient interface. |
| 40 template<class Base, typename P, typename R> | 40 template<class Base, typename P, typename R> |
| 41 class WebFrameTestProxy : public Base, public WebTestProxyBase { | 41 class WebFrameTestProxy : public Base { |
| 42 public: | 42 public: |
| 43 WebFrameTestProxy(P p, R r) | 43 WebFrameTestProxy(P p, R r) |
| 44 : Base(p, r) | 44 : Base(p, r) |
| 45 { | 45 , m_baseProxy(0) { } |
| 46 } | 46 |
| 47 virtual ~WebFrameTestProxy() { } | 47 virtual ~WebFrameTestProxy() { } |
| 48 | 48 |
| 49 void setBaseProxy(WebTestProxyBase* proxy) | 49 void setBaseProxy(WebTestProxyBase* proxy) |
| 50 { | 50 { |
| 51 m_baseProxy = proxy; | 51 m_baseProxy = proxy; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // WebFrameClient implementation. | 54 // WebFrameClient implementation. |
| 55 virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit
::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime) | 55 virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit
::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime) |
| 56 { | 56 { |
| 57 m_baseProxy->willPerformClientRedirect(frame, from, to, interval, fireTi
me); | |
| 58 Base::willPerformClientRedirect(frame, from, to, interval, fireTime); | 57 Base::willPerformClientRedirect(frame, from, to, interval, fireTime); |
| 59 } | 58 } |
| 60 virtual void didCancelClientRedirect(WebKit::WebFrame* frame) | 59 virtual void didCancelClientRedirect(WebKit::WebFrame* frame) |
| 61 { | 60 { |
| 62 m_baseProxy->didCancelClientRedirect(frame); | |
| 63 Base::didCancelClientRedirect(frame); | 61 Base::didCancelClientRedirect(frame); |
| 64 } | 62 } |
| 65 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame) | 63 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame) |
| 66 { | 64 { |
| 67 m_baseProxy->didStartProvisionalLoad(frame); | |
| 68 Base::didStartProvisionalLoad(frame); | 65 Base::didStartProvisionalLoad(frame); |
| 69 } | 66 } |
| 70 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame* fr
ame) | 67 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame* fr
ame) |
| 71 { | 68 { |
| 72 m_baseProxy->didReceiveServerRedirectForProvisionalLoad(frame); | |
| 73 Base::didReceiveServerRedirectForProvisionalLoad(frame); | 69 Base::didReceiveServerRedirectForProvisionalLoad(frame); |
| 74 } | 70 } |
| 75 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame, const WebKit::W
ebURLError& error) | 71 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame, const WebKit::W
ebURLError& error) |
| 76 { | 72 { |
| 77 // If the test finished, don't notify the embedder of the failed load, | |
| 78 // as we already destroyed the document loader. | |
| 79 if (m_baseProxy->didFailProvisionalLoad(frame, error)) | |
| 80 return; | |
| 81 Base::didFailProvisionalLoad(frame, error); | 73 Base::didFailProvisionalLoad(frame, error); |
| 82 } | 74 } |
| 83 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame, bool isNewNav
igation) | 75 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame, bool isNewNav
igation) |
| 84 { | 76 { |
| 85 m_baseProxy->didCommitProvisionalLoad(frame, isNewNavigation); | |
| 86 Base::didCommitProvisionalLoad(frame, isNewNavigation); | 77 Base::didCommitProvisionalLoad(frame, isNewNavigation); |
| 87 } | 78 } |
| 88 virtual void didReceiveTitle(WebKit::WebFrame* frame, const WebKit::WebStrin
g& title, WebKit::WebTextDirection direction) | 79 virtual void didReceiveTitle(WebKit::WebFrame* frame, const WebKit::WebStrin
g& title, WebKit::WebTextDirection direction) |
| 89 { | 80 { |
| 90 m_baseProxy->didReceiveTitle(frame, title, direction); | |
| 91 Base::didReceiveTitle(frame, title, direction); | 81 Base::didReceiveTitle(frame, title, direction); |
| 92 } | 82 } |
| 93 virtual void didChangeIcon(WebKit::WebFrame* frame, WebKit::WebIconURL::Type
iconType) | 83 virtual void didChangeIcon(WebKit::WebFrame* frame, WebKit::WebIconURL::Type
iconType) |
| 94 { | 84 { |
| 95 m_baseProxy->didChangeIcon(frame, iconType); | |
| 96 Base::didChangeIcon(frame, iconType); | 85 Base::didChangeIcon(frame, iconType); |
| 97 } | 86 } |
| 98 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame) | 87 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame) |
| 99 { | 88 { |
| 100 m_baseProxy->didFinishDocumentLoad(frame); | |
| 101 Base::didFinishDocumentLoad(frame); | 89 Base::didFinishDocumentLoad(frame); |
| 102 } | 90 } |
| 103 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame) | 91 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame) |
| 104 { | 92 { |
| 105 m_baseProxy->didHandleOnloadEvents(frame); | |
| 106 Base::didHandleOnloadEvents(frame); | 93 Base::didHandleOnloadEvents(frame); |
| 107 } | 94 } |
| 108 virtual void didFailLoad(WebKit::WebFrame* frame, const WebKit::WebURLError&
error) | 95 virtual void didFailLoad(WebKit::WebFrame* frame, const WebKit::WebURLError&
error) |
| 109 { | 96 { |
| 110 m_baseProxy->didFailLoad(frame, error); | |
| 111 Base::didFailLoad(frame, error); | 97 Base::didFailLoad(frame, error); |
| 112 } | 98 } |
| 113 virtual void didFinishLoad(WebKit::WebFrame* frame) | 99 virtual void didFinishLoad(WebKit::WebFrame* frame) |
| 114 { | 100 { |
| 115 m_baseProxy->didFinishLoad(frame); | |
| 116 Base::didFinishLoad(frame); | 101 Base::didFinishLoad(frame); |
| 117 } | 102 } |
| 118 virtual void didChangeLocationWithinPage(WebKit::WebFrame* frame) | 103 virtual void didChangeLocationWithinPage(WebKit::WebFrame* frame) |
| 119 { | 104 { |
| 105 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 106 // into the base proxy. |
| 120 m_baseProxy->didChangeLocationWithinPage(frame); | 107 m_baseProxy->didChangeLocationWithinPage(frame); |
| 121 Base::didChangeLocationWithinPage(frame); | 108 Base::didChangeLocationWithinPage(frame); |
| 122 } | 109 } |
| 123 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame) | 110 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame) |
| 124 { | 111 { |
| 125 m_baseProxy->didDisplayInsecureContent(frame); | |
| 126 Base::didDisplayInsecureContent(frame); | 112 Base::didDisplayInsecureContent(frame); |
| 127 } | 113 } |
| 128 virtual void didRunInsecureContent(WebKit::WebFrame* frame, const WebKit::We
bSecurityOrigin& origin, const WebKit::WebURL& insecureURL) | 114 virtual void didRunInsecureContent(WebKit::WebFrame* frame, const WebKit::We
bSecurityOrigin& origin, const WebKit::WebURL& insecureURL) |
| 129 { | 115 { |
| 130 m_baseProxy->didRunInsecureContent(frame, origin, insecureURL); | |
| 131 Base::didRunInsecureContent(frame, origin, insecureURL); | 116 Base::didRunInsecureContent(frame, origin, insecureURL); |
| 132 } | 117 } |
| 133 virtual void didDetectXSS(WebKit::WebFrame* frame, const WebKit::WebURL& ins
ecureURL, bool didBlockEntirePage) | 118 virtual void didDetectXSS(WebKit::WebFrame* frame, const WebKit::WebURL& ins
ecureURL, bool didBlockEntirePage) |
| 134 { | 119 { |
| 120 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 121 // into the base proxy. |
| 135 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); | 122 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 136 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); | 123 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 137 } | 124 } |
| 138 virtual void willRequestResource(WebKit::WebFrame* frame, const WebKit::WebC
achedURLRequest& request) | 125 virtual void willRequestResource(WebKit::WebFrame* frame, const WebKit::WebC
achedURLRequest& request) |
| 139 { | 126 { |
| 127 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 128 // into the base proxy. |
| 140 m_baseProxy->willRequestResource(frame, request); | 129 m_baseProxy->willRequestResource(frame, request); |
| 141 Base::willRequestResource(frame, request); | 130 Base::willRequestResource(frame, request); |
| 142 } | 131 } |
| 143 virtual WebKit::WebURLError cannotHandleRequestError(WebKit::WebFrame* frame
, const WebKit::WebURLRequest& request) | 132 virtual WebKit::WebURLError cannotHandleRequestError(WebKit::WebFrame* frame
, const WebKit::WebURLRequest& request) |
| 144 { | 133 { |
| 145 return m_baseProxy->cannotHandleRequestError(frame, request); | 134 return Base::cannotHandleRequestError(frame, request); |
| 146 } | 135 } |
| 147 virtual void didCreateDataSource(WebKit::WebFrame* frame, WebKit::WebDataSou
rce* ds) | 136 virtual void didCreateDataSource(WebKit::WebFrame* frame, WebKit::WebDataSou
rce* ds) |
| 148 { | 137 { |
| 149 m_baseProxy->didCreateDataSource(frame, ds); | |
| 150 Base::didCreateDataSource(frame, ds); | 138 Base::didCreateDataSource(frame, ds); |
| 151 } | 139 } |
| 152 virtual void willSendRequest(WebKit::WebFrame* frame, unsigned identifier, W
ebKit::WebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) | 140 virtual void willSendRequest(WebKit::WebFrame* frame, unsigned identifier, W
ebKit::WebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) |
| 153 { | 141 { |
| 154 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons
e); | |
| 155 Base::willSendRequest(frame, identifier, request, redirectResponse); | 142 Base::willSendRequest(frame, identifier, request, redirectResponse); |
| 156 } | 143 } |
| 157 virtual void didReceiveResponse(WebKit::WebFrame* frame, unsigned identifier
, const WebKit::WebURLResponse& response) | 144 virtual void didReceiveResponse(WebKit::WebFrame* frame, unsigned identifier
, const WebKit::WebURLResponse& response) |
| 158 { | 145 { |
| 159 m_baseProxy->didReceiveResponse(frame, identifier, response); | |
| 160 Base::didReceiveResponse(frame, identifier, response); | 146 Base::didReceiveResponse(frame, identifier, response); |
| 161 } | 147 } |
| 162 virtual void didChangeResourcePriority(WebKit::WebFrame* frame, unsigned ide
ntifier, const WebKit::WebURLRequest::Priority& priority) | 148 virtual void didChangeResourcePriority(WebKit::WebFrame* frame, unsigned ide
ntifier, const WebKit::WebURLRequest::Priority& priority) |
| 163 { | 149 { |
| 150 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 151 // into the base proxy. |
| 164 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); | 152 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); |
| 165 Base::didChangeResourcePriority(frame, identifier, priority); | 153 Base::didChangeResourcePriority(frame, identifier, priority); |
| 166 } | 154 } |
| 167 virtual void didFinishResourceLoad(WebKit::WebFrame* frame, unsigned identif
ier) | 155 virtual void didFinishResourceLoad(WebKit::WebFrame* frame, unsigned identif
ier) |
| 168 { | 156 { |
| 169 m_baseProxy->didFinishResourceLoad(frame, identifier); | |
| 170 Base::didFinishResourceLoad(frame, identifier); | 157 Base::didFinishResourceLoad(frame, identifier); |
| 171 } | 158 } |
| 172 virtual void didFailResourceLoad(WebKit::WebFrame* frame, unsigned identifie
r, const WebKit::WebURLError& error) | 159 virtual void didFailResourceLoad(WebKit::WebFrame* frame, unsigned identifie
r, const WebKit::WebURLError& error) |
| 173 { | 160 { |
| 174 m_baseProxy->didFailResourceLoad(frame, identifier, error); | |
| 175 Base::didFailResourceLoad(frame, identifier, error); | 161 Base::didFailResourceLoad(frame, identifier, error); |
| 176 } | 162 } |
| 177 virtual void unableToImplementPolicyWithError(WebKit::WebFrame* frame, const
WebKit::WebURLError& error) | 163 virtual void unableToImplementPolicyWithError(WebKit::WebFrame* frame, const
WebKit::WebURLError& error) |
| 178 { | 164 { |
| 179 m_baseProxy->unableToImplementPolicyWithError(frame, error); | |
| 180 Base::unableToImplementPolicyWithError(frame, error); | 165 Base::unableToImplementPolicyWithError(frame, error); |
| 181 } | 166 } |
| 182 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(WebKit::WebFra
me* frame, const WebKit::WebURLRequest& request, WebKit::WebNavigationType type,
WebKit::WebNavigationPolicy defaultPolicy, bool isRedirect) | 167 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(WebKit::WebFra
me* frame, const WebKit::WebURLRequest& request, WebKit::WebNavigationType type,
WebKit::WebNavigationPolicy defaultPolicy, bool isRedirect) |
| 183 { | 168 { |
| 184 WebKit::WebNavigationPolicy policy = m_baseProxy->decidePolicyForNavigat
ion(frame, request, type, defaultPolicy, isRedirect); | |
| 185 if (policy == WebKit::WebNavigationPolicyIgnore) | |
| 186 return policy; | |
| 187 return Base::decidePolicyForNavigation(frame, request, type, defaultPoli
cy, isRedirect); | 169 return Base::decidePolicyForNavigation(frame, request, type, defaultPoli
cy, isRedirect); |
| 188 } | 170 } |
| 189 virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* sourceFrame,
WebKit::WebFrame* targetFrame, WebKit::WebSecurityOrigin target, WebKit::WebDOM
MessageEvent event) | 171 virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* sourceFrame,
WebKit::WebFrame* targetFrame, WebKit::WebSecurityOrigin target, WebKit::WebDOM
MessageEvent event) |
| 190 { | 172 { |
| 191 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra
me, target, event)) | 173 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra
me, target, event)) |
| 192 return true; | 174 return true; |
| 193 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame,
target, event); | 175 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame,
target, event); |
| 194 } | 176 } |
| 195 virtual WebKit::WebColorChooser* createColorChooser(WebKit::WebColorChooserC
lient* client, const WebKit::WebColor& color) | |
| 196 { | |
| 197 return m_baseProxy->createColorChooser(client, color); | |
| 198 } | |
| 199 | |
| 200 | 177 |
| 201 private: | 178 private: |
| 202 WebTestProxyBase* m_baseProxy; | 179 WebTestProxyBase* m_baseProxy; |
| 203 }; | 180 }; |
| 204 | 181 |
| 205 } | 182 } |
| 206 | 183 |
| 207 #endif // WebTestProxy_h | 184 #endif // WebTestProxy_h |
| OLD | NEW |