Chromium Code Reviews| 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 { |
| 46 m_baseProxy = 0; | |
|
jochen (gone - plz use gerrit)
2013/06/28 08:48:24
nit: move to initializer list
nasko
2013/06/28 15:12:48
Done.
| |
| 46 } | 47 } |
| 47 virtual ~WebFrameTestProxy() { } | 48 virtual ~WebFrameTestProxy() { } |
| 48 | 49 |
| 49 void setBaseProxy(WebTestProxyBase* proxy) | 50 void setBaseProxy(WebTestProxyBase* proxy) |
| 50 { | 51 { |
| 51 m_baseProxy = proxy; | 52 m_baseProxy = proxy; |
| 52 } | 53 } |
| 53 | 54 |
| 54 // WebFrameClient implementation. | 55 // WebFrameClient implementation. |
| 55 virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit ::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime) | 56 virtual void willPerformClientRedirect(WebKit::WebFrame* frame, const WebKit ::WebURL& from, const WebKit::WebURL& to, double interval, double fireTime) |
| 56 { | 57 { |
| 57 m_baseProxy->willPerformClientRedirect(frame, from, to, interval, fireTi me); | |
| 58 Base::willPerformClientRedirect(frame, from, to, interval, fireTime); | 58 Base::willPerformClientRedirect(frame, from, to, interval, fireTime); |
| 59 } | 59 } |
| 60 virtual void didCancelClientRedirect(WebKit::WebFrame* frame) | 60 virtual void didCancelClientRedirect(WebKit::WebFrame* frame) |
| 61 { | 61 { |
| 62 m_baseProxy->didCancelClientRedirect(frame); | |
| 63 Base::didCancelClientRedirect(frame); | 62 Base::didCancelClientRedirect(frame); |
| 64 } | 63 } |
| 65 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame) | 64 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame) |
| 66 { | 65 { |
| 67 m_baseProxy->didStartProvisionalLoad(frame); | |
| 68 Base::didStartProvisionalLoad(frame); | 66 Base::didStartProvisionalLoad(frame); |
| 69 } | 67 } |
| 70 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame* fr ame) | 68 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame* fr ame) |
| 71 { | 69 { |
| 72 m_baseProxy->didReceiveServerRedirectForProvisionalLoad(frame); | |
| 73 Base::didReceiveServerRedirectForProvisionalLoad(frame); | 70 Base::didReceiveServerRedirectForProvisionalLoad(frame); |
| 74 } | 71 } |
| 75 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame, const WebKit::W ebURLError& error) | 72 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame, const WebKit::W ebURLError& error) |
| 76 { | 73 { |
| 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); | 74 Base::didFailProvisionalLoad(frame, error); |
| 82 } | 75 } |
| 83 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame, bool isNewNav igation) | 76 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame, bool isNewNav igation) |
| 84 { | 77 { |
| 85 m_baseProxy->didCommitProvisionalLoad(frame, isNewNavigation); | |
| 86 Base::didCommitProvisionalLoad(frame, isNewNavigation); | 78 Base::didCommitProvisionalLoad(frame, isNewNavigation); |
| 87 } | 79 } |
| 88 virtual void didReceiveTitle(WebKit::WebFrame* frame, const WebKit::WebStrin g& title, WebKit::WebTextDirection direction) | 80 virtual void didReceiveTitle(WebKit::WebFrame* frame, const WebKit::WebStrin g& title, WebKit::WebTextDirection direction) |
| 89 { | 81 { |
| 90 m_baseProxy->didReceiveTitle(frame, title, direction); | |
| 91 Base::didReceiveTitle(frame, title, direction); | 82 Base::didReceiveTitle(frame, title, direction); |
| 92 } | 83 } |
| 93 virtual void didChangeIcon(WebKit::WebFrame* frame, WebKit::WebIconURL::Type iconType) | 84 virtual void didChangeIcon(WebKit::WebFrame* frame, WebKit::WebIconURL::Type iconType) |
| 94 { | 85 { |
| 95 m_baseProxy->didChangeIcon(frame, iconType); | |
| 96 Base::didChangeIcon(frame, iconType); | 86 Base::didChangeIcon(frame, iconType); |
| 97 } | 87 } |
| 98 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame) | 88 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame) |
| 99 { | 89 { |
| 100 m_baseProxy->didFinishDocumentLoad(frame); | |
| 101 Base::didFinishDocumentLoad(frame); | 90 Base::didFinishDocumentLoad(frame); |
| 102 } | 91 } |
| 103 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame) | 92 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame) |
| 104 { | 93 { |
| 105 m_baseProxy->didHandleOnloadEvents(frame); | |
| 106 Base::didHandleOnloadEvents(frame); | 94 Base::didHandleOnloadEvents(frame); |
| 107 } | 95 } |
| 108 virtual void didFailLoad(WebKit::WebFrame* frame, const WebKit::WebURLError& error) | 96 virtual void didFailLoad(WebKit::WebFrame* frame, const WebKit::WebURLError& error) |
| 109 { | 97 { |
| 110 m_baseProxy->didFailLoad(frame, error); | |
| 111 Base::didFailLoad(frame, error); | 98 Base::didFailLoad(frame, error); |
| 112 } | 99 } |
| 113 virtual void didFinishLoad(WebKit::WebFrame* frame) | 100 virtual void didFinishLoad(WebKit::WebFrame* frame) |
| 114 { | 101 { |
| 115 m_baseProxy->didFinishLoad(frame); | |
| 116 Base::didFinishLoad(frame); | 102 Base::didFinishLoad(frame); |
| 117 } | 103 } |
| 118 virtual void didChangeLocationWithinPage(WebKit::WebFrame* frame) | 104 virtual void didChangeLocationWithinPage(WebKit::WebFrame* frame) |
| 119 { | 105 { |
| 106 // This is not implemented in RenderFrameImpl, so need to explicitly cal l | |
| 107 // into the base proxy. | |
|
jochen (gone - plz use gerrit)
2013/06/28 08:48:24
why not implement all these in RenderFrameImpl?
nasko
2013/06/28 15:12:48
They aren't implemented in RenderViewImpl either,
| |
| 120 m_baseProxy->didChangeLocationWithinPage(frame); | 108 m_baseProxy->didChangeLocationWithinPage(frame); |
| 121 Base::didChangeLocationWithinPage(frame); | 109 Base::didChangeLocationWithinPage(frame); |
| 122 } | 110 } |
| 123 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame) | 111 virtual void didDisplayInsecureContent(WebKit::WebFrame* frame) |
| 124 { | 112 { |
| 125 m_baseProxy->didDisplayInsecureContent(frame); | |
| 126 Base::didDisplayInsecureContent(frame); | 113 Base::didDisplayInsecureContent(frame); |
| 127 } | 114 } |
| 128 virtual void didRunInsecureContent(WebKit::WebFrame* frame, const WebKit::We bSecurityOrigin& origin, const WebKit::WebURL& insecureURL) | 115 virtual void didRunInsecureContent(WebKit::WebFrame* frame, const WebKit::We bSecurityOrigin& origin, const WebKit::WebURL& insecureURL) |
| 129 { | 116 { |
| 130 m_baseProxy->didRunInsecureContent(frame, origin, insecureURL); | |
| 131 Base::didRunInsecureContent(frame, origin, insecureURL); | 117 Base::didRunInsecureContent(frame, origin, insecureURL); |
| 132 } | 118 } |
| 133 virtual void didDetectXSS(WebKit::WebFrame* frame, const WebKit::WebURL& ins ecureURL, bool didBlockEntirePage) | 119 virtual void didDetectXSS(WebKit::WebFrame* frame, const WebKit::WebURL& ins ecureURL, bool didBlockEntirePage) |
| 134 { | 120 { |
| 121 // This is not implemented in RenderFrameImpl, so need to explicitly cal l | |
| 122 // into the base proxy. | |
| 135 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); | 123 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 136 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); | 124 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 137 } | 125 } |
| 138 virtual void willRequestResource(WebKit::WebFrame* frame, const WebKit::WebC achedURLRequest& request) | 126 virtual void willRequestResource(WebKit::WebFrame* frame, const WebKit::WebC achedURLRequest& request) |
| 139 { | 127 { |
| 128 // This is not implemented in RenderFrameImpl, so need to explicitly cal l | |
| 129 // into the base proxy. | |
| 140 m_baseProxy->willRequestResource(frame, request); | 130 m_baseProxy->willRequestResource(frame, request); |
| 141 Base::willRequestResource(frame, request); | 131 Base::willRequestResource(frame, request); |
| 142 } | 132 } |
| 143 virtual WebKit::WebURLError cannotHandleRequestError(WebKit::WebFrame* frame , const WebKit::WebURLRequest& request) | 133 virtual WebKit::WebURLError cannotHandleRequestError(WebKit::WebFrame* frame , const WebKit::WebURLRequest& request) |
| 144 { | 134 { |
| 145 return m_baseProxy->cannotHandleRequestError(frame, request); | 135 return Base::cannotHandleRequestError(frame, request); |
| 146 } | 136 } |
| 147 virtual void didCreateDataSource(WebKit::WebFrame* frame, WebKit::WebDataSou rce* ds) | 137 virtual void didCreateDataSource(WebKit::WebFrame* frame, WebKit::WebDataSou rce* ds) |
| 148 { | 138 { |
| 149 m_baseProxy->didCreateDataSource(frame, ds); | |
| 150 Base::didCreateDataSource(frame, ds); | 139 Base::didCreateDataSource(frame, ds); |
| 151 } | 140 } |
| 152 virtual void willSendRequest(WebKit::WebFrame* frame, unsigned identifier, W ebKit::WebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) | 141 virtual void willSendRequest(WebKit::WebFrame* frame, unsigned identifier, W ebKit::WebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) |
| 153 { | 142 { |
| 154 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons e); | |
| 155 Base::willSendRequest(frame, identifier, request, redirectResponse); | 143 Base::willSendRequest(frame, identifier, request, redirectResponse); |
| 156 } | 144 } |
| 157 virtual void didReceiveResponse(WebKit::WebFrame* frame, unsigned identifier , const WebKit::WebURLResponse& response) | 145 virtual void didReceiveResponse(WebKit::WebFrame* frame, unsigned identifier , const WebKit::WebURLResponse& response) |
| 158 { | 146 { |
| 159 m_baseProxy->didReceiveResponse(frame, identifier, response); | |
| 160 Base::didReceiveResponse(frame, identifier, response); | 147 Base::didReceiveResponse(frame, identifier, response); |
| 161 } | 148 } |
| 162 virtual void didChangeResourcePriority(WebKit::WebFrame* frame, unsigned ide ntifier, const WebKit::WebURLRequest::Priority& priority) | 149 virtual void didChangeResourcePriority(WebKit::WebFrame* frame, unsigned ide ntifier, const WebKit::WebURLRequest::Priority& priority) |
| 163 { | 150 { |
| 151 // This is not implemented in RenderFrameImpl, so need to explicitly cal l | |
| 152 // into the base proxy. | |
| 164 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); | 153 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); |
| 165 Base::didChangeResourcePriority(frame, identifier, priority); | 154 Base::didChangeResourcePriority(frame, identifier, priority); |
| 166 } | 155 } |
| 167 virtual void didFinishResourceLoad(WebKit::WebFrame* frame, unsigned identif ier) | 156 virtual void didFinishResourceLoad(WebKit::WebFrame* frame, unsigned identif ier) |
| 168 { | 157 { |
| 169 m_baseProxy->didFinishResourceLoad(frame, identifier); | |
| 170 Base::didFinishResourceLoad(frame, identifier); | 158 Base::didFinishResourceLoad(frame, identifier); |
| 171 } | 159 } |
| 172 virtual void didFailResourceLoad(WebKit::WebFrame* frame, unsigned identifie r, const WebKit::WebURLError& error) | 160 virtual void didFailResourceLoad(WebKit::WebFrame* frame, unsigned identifie r, const WebKit::WebURLError& error) |
| 173 { | 161 { |
| 174 m_baseProxy->didFailResourceLoad(frame, identifier, error); | |
| 175 Base::didFailResourceLoad(frame, identifier, error); | 162 Base::didFailResourceLoad(frame, identifier, error); |
| 176 } | 163 } |
| 177 virtual void unableToImplementPolicyWithError(WebKit::WebFrame* frame, const WebKit::WebURLError& error) | 164 virtual void unableToImplementPolicyWithError(WebKit::WebFrame* frame, const WebKit::WebURLError& error) |
| 178 { | 165 { |
| 179 m_baseProxy->unableToImplementPolicyWithError(frame, error); | |
| 180 Base::unableToImplementPolicyWithError(frame, error); | 166 Base::unableToImplementPolicyWithError(frame, error); |
| 181 } | 167 } |
| 182 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(WebKit::WebFra me* frame, const WebKit::WebURLRequest& request, WebKit::WebNavigationType type, WebKit::WebNavigationPolicy defaultPolicy, bool isRedirect) | 168 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(WebKit::WebFra me* frame, const WebKit::WebURLRequest& request, WebKit::WebNavigationType type, WebKit::WebNavigationPolicy defaultPolicy, bool isRedirect) |
| 183 { | 169 { |
| 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); | 170 return Base::decidePolicyForNavigation(frame, request, type, defaultPoli cy, isRedirect); |
| 188 } | 171 } |
| 189 virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* sourceFrame, WebKit::WebFrame* targetFrame, WebKit::WebSecurityOrigin target, WebKit::WebDOM MessageEvent event) | 172 virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* sourceFrame, WebKit::WebFrame* targetFrame, WebKit::WebSecurityOrigin target, WebKit::WebDOM MessageEvent event) |
| 190 { | 173 { |
| 191 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra me, target, event)) | 174 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra me, target, event)) |
| 192 return true; | 175 return true; |
| 193 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame, target, event); | 176 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame, target, event); |
| 194 } | 177 } |
| 195 virtual WebKit::WebColorChooser* createColorChooser(WebKit::WebColorChooserC lient* client, const WebKit::WebColor& color) | |
| 196 { | |
| 197 return m_baseProxy->createColorChooser(client, color); | |
| 198 } | |
| 199 | |
| 200 | 178 |
| 201 private: | 179 private: |
| 202 WebTestProxyBase* m_baseProxy; | 180 WebTestProxyBase* m_baseProxy; |
| 203 }; | 181 }; |
| 204 | 182 |
| 205 } | 183 } |
| 206 | 184 |
| 207 #endif // WebTestProxy_h | 185 #endif // WebTestProxy_h |
| OLD | NEW |