| 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 21 matching lines...) Expand all Loading... |
| 32 #define WebFrameTestProxy_h | 32 #define WebFrameTestProxy_h |
| 33 | 33 |
| 34 #include "WebTestProxy.h" | 34 #include "WebTestProxy.h" |
| 35 #include "public/platform/WebNonCopyable.h" | 35 #include "public/platform/WebNonCopyable.h" |
| 36 | 36 |
| 37 namespace WebTestRunner { | 37 namespace WebTestRunner { |
| 38 | 38 |
| 39 // Templetized wrapper around RenderFrameImpl objects, which implement | 39 // Templetized wrapper around RenderFrameImpl objects, which implement |
| 40 // the WebFrameClient interface. | 40 // the WebFrameClient interface. |
| 41 template<class Base, typename P, typename R> | 41 template<class Base, typename P, typename R> |
| 42 class WebFrameTestProxy : public Base, public WebKit::WebNonCopyable { | 42 class WebFrameTestProxy : public Base, public blink::WebNonCopyable { |
| 43 public: | 43 public: |
| 44 WebFrameTestProxy(P p, R r) | 44 WebFrameTestProxy(P p, R r) |
| 45 : Base(p, r) | 45 : Base(p, r) |
| 46 , m_baseProxy(0) | 46 , m_baseProxy(0) |
| 47 , m_version(0) { } | 47 , m_version(0) { } |
| 48 | 48 |
| 49 virtual ~WebFrameTestProxy() { } | 49 virtual ~WebFrameTestProxy() { } |
| 50 | 50 |
| 51 void setBaseProxy(WebTestProxyBase* proxy) | 51 void setBaseProxy(WebTestProxyBase* proxy) |
| 52 { | 52 { |
| 53 m_baseProxy = proxy; | 53 m_baseProxy = proxy; |
| 54 } | 54 } |
| 55 | 55 |
| 56 void setVersion(int version) | 56 void setVersion(int version) |
| 57 { | 57 { |
| 58 m_version = version; | 58 m_version = version; |
| 59 } | 59 } |
| 60 | 60 |
| 61 WebKit::WebPlugin* createPlugin(WebKit::WebFrame* frame, const WebKit::WebPl
uginParams& params) | 61 blink::WebPlugin* createPlugin(blink::WebFrame* frame, const blink::WebPlugi
nParams& params) |
| 62 { | 62 { |
| 63 WebKit::WebPlugin* plugin = m_baseProxy->createPlugin(frame, params); | 63 blink::WebPlugin* plugin = m_baseProxy->createPlugin(frame, params); |
| 64 if (plugin) | 64 if (plugin) |
| 65 return plugin; | 65 return plugin; |
| 66 return Base::createPlugin(frame, params); | 66 return Base::createPlugin(frame, params); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // WebFrameClient implementation. | 69 // WebFrameClient implementation. |
| 70 virtual void didStartProvisionalLoad(WebKit::WebFrame* frame) | 70 virtual void didStartProvisionalLoad(blink::WebFrame* frame) |
| 71 { | 71 { |
| 72 if (m_version > 2) | 72 if (m_version > 2) |
| 73 m_baseProxy->didStartProvisionalLoad(frame); | 73 m_baseProxy->didStartProvisionalLoad(frame); |
| 74 Base::didStartProvisionalLoad(frame); | 74 Base::didStartProvisionalLoad(frame); |
| 75 } | 75 } |
| 76 virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame* fr
ame) | 76 virtual void didReceiveServerRedirectForProvisionalLoad(blink::WebFrame* fra
me) |
| 77 { | 77 { |
| 78 Base::didReceiveServerRedirectForProvisionalLoad(frame); | 78 Base::didReceiveServerRedirectForProvisionalLoad(frame); |
| 79 } | 79 } |
| 80 virtual void didFailProvisionalLoad(WebKit::WebFrame* frame, const WebKit::W
ebURLError& error) | 80 virtual void didFailProvisionalLoad(blink::WebFrame* frame, const blink::Web
URLError& error) |
| 81 { | 81 { |
| 82 Base::didFailProvisionalLoad(frame, error); | 82 Base::didFailProvisionalLoad(frame, error); |
| 83 } | 83 } |
| 84 virtual void didCommitProvisionalLoad(WebKit::WebFrame* frame, bool isNewNav
igation) | 84 virtual void didCommitProvisionalLoad(blink::WebFrame* frame, bool isNewNavi
gation) |
| 85 { | 85 { |
| 86 Base::didCommitProvisionalLoad(frame, isNewNavigation); | 86 Base::didCommitProvisionalLoad(frame, isNewNavigation); |
| 87 } | 87 } |
| 88 virtual void didReceiveTitle(WebKit::WebFrame* frame, const WebKit::WebStrin
g& title, WebKit::WebTextDirection direction) | 88 virtual void didReceiveTitle(blink::WebFrame* frame, const blink::WebString&
title, blink::WebTextDirection direction) |
| 89 { | 89 { |
| 90 Base::didReceiveTitle(frame, title, direction); | 90 Base::didReceiveTitle(frame, title, direction); |
| 91 } | 91 } |
| 92 virtual void didChangeIcon(WebKit::WebFrame* frame, WebKit::WebIconURL::Type
iconType) | 92 virtual void didChangeIcon(blink::WebFrame* frame, blink::WebIconURL::Type i
conType) |
| 93 { | 93 { |
| 94 Base::didChangeIcon(frame, iconType); | 94 Base::didChangeIcon(frame, iconType); |
| 95 } | 95 } |
| 96 virtual void didFinishDocumentLoad(WebKit::WebFrame* frame) | 96 virtual void didFinishDocumentLoad(blink::WebFrame* frame) |
| 97 { | 97 { |
| 98 Base::didFinishDocumentLoad(frame); | 98 Base::didFinishDocumentLoad(frame); |
| 99 } | 99 } |
| 100 virtual void didHandleOnloadEvents(WebKit::WebFrame* frame) | 100 virtual void didHandleOnloadEvents(blink::WebFrame* frame) |
| 101 { | 101 { |
| 102 Base::didHandleOnloadEvents(frame); | 102 Base::didHandleOnloadEvents(frame); |
| 103 } | 103 } |
| 104 virtual void didFailLoad(WebKit::WebFrame* frame, const WebKit::WebURLError&
error) | 104 virtual void didFailLoad(blink::WebFrame* frame, const blink::WebURLError& e
rror) |
| 105 { | 105 { |
| 106 Base::didFailLoad(frame, error); | 106 Base::didFailLoad(frame, error); |
| 107 } | 107 } |
| 108 virtual void didFinishLoad(WebKit::WebFrame* frame) | 108 virtual void didFinishLoad(blink::WebFrame* frame) |
| 109 { | 109 { |
| 110 Base::didFinishLoad(frame); | 110 Base::didFinishLoad(frame); |
| 111 } | 111 } |
| 112 virtual void didDetectXSS(WebKit::WebFrame* frame, const WebKit::WebURL& ins
ecureURL, bool didBlockEntirePage) | 112 virtual void didDetectXSS(blink::WebFrame* frame, const blink::WebURL& insec
ureURL, bool didBlockEntirePage) |
| 113 { | 113 { |
| 114 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 114 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 115 // into the base proxy. | 115 // into the base proxy. |
| 116 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); | 116 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 117 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); | 117 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage); |
| 118 } | 118 } |
| 119 virtual void didDispatchPingLoader(WebKit::WebFrame* frame, const WebKit::We
bURL& url) | 119 virtual void didDispatchPingLoader(blink::WebFrame* frame, const blink::WebU
RL& url) |
| 120 { | 120 { |
| 121 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 121 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 122 // into the base proxy. | 122 // into the base proxy. |
| 123 m_baseProxy->didDispatchPingLoader(frame, url); | 123 m_baseProxy->didDispatchPingLoader(frame, url); |
| 124 Base::didDispatchPingLoader(frame, url); | 124 Base::didDispatchPingLoader(frame, url); |
| 125 } | 125 } |
| 126 virtual void willRequestResource(WebKit::WebFrame* frame, const WebKit::WebC
achedURLRequest& request) | 126 virtual void willRequestResource(blink::WebFrame* frame, const blink::WebCac
hedURLRequest& request) |
| 127 { | 127 { |
| 128 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 128 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 129 // into the base proxy. | 129 // into the base proxy. |
| 130 m_baseProxy->willRequestResource(frame, request); | 130 m_baseProxy->willRequestResource(frame, request); |
| 131 Base::willRequestResource(frame, request); | 131 Base::willRequestResource(frame, request); |
| 132 } | 132 } |
| 133 virtual void didCreateDataSource(WebKit::WebFrame* frame, WebKit::WebDataSou
rce* ds) | 133 virtual void didCreateDataSource(blink::WebFrame* frame, blink::WebDataSourc
e* ds) |
| 134 { | 134 { |
| 135 Base::didCreateDataSource(frame, ds); | 135 Base::didCreateDataSource(frame, ds); |
| 136 } | 136 } |
| 137 virtual void willSendRequest(WebKit::WebFrame* frame, unsigned identifier, W
ebKit::WebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) | 137 virtual void willSendRequest(blink::WebFrame* frame, unsigned identifier, bl
ink::WebURLRequest& request, const blink::WebURLResponse& redirectResponse) |
| 138 { | 138 { |
| 139 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons
e); | 139 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons
e); |
| 140 Base::willSendRequest(frame, identifier, request, redirectResponse); | 140 Base::willSendRequest(frame, identifier, request, redirectResponse); |
| 141 } | 141 } |
| 142 virtual void didReceiveResponse(WebKit::WebFrame* frame, unsigned identifier
, const WebKit::WebURLResponse& response) | 142 virtual void didReceiveResponse(blink::WebFrame* frame, unsigned identifier,
const blink::WebURLResponse& response) |
| 143 { | 143 { |
| 144 m_baseProxy->didReceiveResponse(frame, identifier, response); | 144 m_baseProxy->didReceiveResponse(frame, identifier, response); |
| 145 Base::didReceiveResponse(frame, identifier, response); | 145 Base::didReceiveResponse(frame, identifier, response); |
| 146 } | 146 } |
| 147 virtual void didChangeResourcePriority(WebKit::WebFrame* frame, unsigned ide
ntifier, const WebKit::WebURLRequest::Priority& priority) | 147 virtual void didChangeResourcePriority(blink::WebFrame* frame, unsigned iden
tifier, const blink::WebURLRequest::Priority& priority) |
| 148 { | 148 { |
| 149 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l | 149 // This is not implemented in RenderFrameImpl, so need to explicitly cal
l |
| 150 // into the base proxy. | 150 // into the base proxy. |
| 151 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); | 151 m_baseProxy->didChangeResourcePriority(frame, identifier, priority); |
| 152 Base::didChangeResourcePriority(frame, identifier, priority); | 152 Base::didChangeResourcePriority(frame, identifier, priority); |
| 153 } | 153 } |
| 154 virtual void didFinishResourceLoad(WebKit::WebFrame* frame, unsigned identif
ier) | 154 virtual void didFinishResourceLoad(blink::WebFrame* frame, unsigned identifi
er) |
| 155 { | 155 { |
| 156 Base::didFinishResourceLoad(frame, identifier); | 156 Base::didFinishResourceLoad(frame, identifier); |
| 157 } | 157 } |
| 158 virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(WebKit::WebFra
me* frame, WebKit::WebDataSource::ExtraData* extraData, const WebKit::WebURLRequ
est& request, WebKit::WebNavigationType type, WebKit::WebNavigationPolicy defaul
tPolicy, bool isRedirect) | 158 virtual blink::WebNavigationPolicy decidePolicyForNavigation(blink::WebFrame
* frame, blink::WebDataSource::ExtraData* extraData, const blink::WebURLRequest&
request, blink::WebNavigationType type, blink::WebNavigationPolicy defaultPolic
y, bool isRedirect) |
| 159 { | 159 { |
| 160 return Base::decidePolicyForNavigation(frame, extraData, request, type,
defaultPolicy, isRedirect); | 160 return Base::decidePolicyForNavigation(frame, extraData, request, type,
defaultPolicy, isRedirect); |
| 161 } | 161 } |
| 162 virtual bool willCheckAndDispatchMessageEvent(WebKit::WebFrame* sourceFrame,
WebKit::WebFrame* targetFrame, WebKit::WebSecurityOrigin target, WebKit::WebDOM
MessageEvent event) | 162 virtual bool willCheckAndDispatchMessageEvent(blink::WebFrame* sourceFrame,
blink::WebFrame* targetFrame, blink::WebSecurityOrigin target, blink::WebDOMMess
ageEvent event) |
| 163 { | 163 { |
| 164 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra
me, target, event)) | 164 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra
me, target, event)) |
| 165 return true; | 165 return true; |
| 166 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame,
target, event); | 166 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame,
target, event); |
| 167 } | 167 } |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 WebTestProxyBase* m_baseProxy; | 170 WebTestProxyBase* m_baseProxy; |
| 171 | 171 |
| 172 // This is used to incrementally change code between Blink and Chromium. | 172 // This is used to incrementally change code between Blink and Chromium. |
| 173 // It is used instead of a #define and is set by layouttest_support when | 173 // It is used instead of a #define and is set by layouttest_support when |
| 174 // creating this object. | 174 // creating this object. |
| 175 int m_version; | 175 int m_version; |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 } | 178 } |
| 179 | 179 |
| 180 #endif // WebTestProxy_h | 180 #endif // WebTestProxy_h |
| OLD | NEW |