Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: content/shell/renderer/test_runner/WebFrameTestProxy.h

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WebFrameTestProxy_h
6 #define WebFrameTestProxy_h
7
8 #include "content/shell/renderer/test_runner/WebTestProxy.h"
9 #include "third_party/WebKit/public/platform/WebNonCopyable.h"
10
11 namespace WebTestRunner {
12
13 // Templetized wrapper around RenderFrameImpl objects, which implement
14 // the WebFrameClient interface.
15 template<class Base, typename P, typename R>
16 class WebFrameTestProxy : public Base, public blink::WebNonCopyable {
17 public:
18 WebFrameTestProxy(P p, R r)
19 : Base(p, r)
20 , m_baseProxy(0)
21 , m_version(0) { }
22
23 virtual ~WebFrameTestProxy() { }
24
25 void setBaseProxy(WebTestProxyBase* proxy)
26 {
27 m_baseProxy = proxy;
28 }
29
30 void setVersion(int version)
31 {
32 m_version = version;
33 }
34
35 blink::WebPlugin* createPlugin(blink::WebFrame* frame, const blink::WebPlugi nParams& params)
36 {
37 blink::WebPlugin* plugin = m_baseProxy->createPlugin(frame, params);
38 if (plugin)
39 return plugin;
40 return Base::createPlugin(frame, params);
41 }
42
43 // WebFrameClient implementation.
44 virtual void didStartProvisionalLoad(blink::WebFrame* frame)
45 {
46 if (m_version > 2)
47 m_baseProxy->didStartProvisionalLoad(frame);
48 Base::didStartProvisionalLoad(frame);
49 }
50 virtual void didReceiveServerRedirectForProvisionalLoad(blink::WebFrame* fra me)
51 {
52 Base::didReceiveServerRedirectForProvisionalLoad(frame);
53 }
54 virtual void didFailProvisionalLoad(blink::WebFrame* frame, const blink::Web URLError& error)
55 {
56 Base::didFailProvisionalLoad(frame, error);
57 }
58 virtual void didCommitProvisionalLoad(blink::WebFrame* frame, bool isNewNavi gation)
59 {
60 Base::didCommitProvisionalLoad(frame, isNewNavigation);
61 }
62 virtual void didReceiveTitle(blink::WebFrame* frame, const blink::WebString& title, blink::WebTextDirection direction)
63 {
64 Base::didReceiveTitle(frame, title, direction);
65 }
66 virtual void didChangeIcon(blink::WebFrame* frame, blink::WebIconURL::Type i conType)
67 {
68 Base::didChangeIcon(frame, iconType);
69 }
70 virtual void didFinishDocumentLoad(blink::WebFrame* frame)
71 {
72 Base::didFinishDocumentLoad(frame);
73 }
74 virtual void didHandleOnloadEvents(blink::WebFrame* frame)
75 {
76 Base::didHandleOnloadEvents(frame);
77 }
78 virtual void didFailLoad(blink::WebFrame* frame, const blink::WebURLError& e rror)
79 {
80 Base::didFailLoad(frame, error);
81 }
82 virtual void didFinishLoad(blink::WebFrame* frame)
83 {
84 Base::didFinishLoad(frame);
85 }
86 virtual void didDetectXSS(blink::WebFrame* frame, const blink::WebURL& insec ureURL, bool didBlockEntirePage)
87 {
88 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
89 // into the base proxy.
90 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage);
91 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage);
92 }
93 virtual void didDispatchPingLoader(blink::WebFrame* frame, const blink::WebU RL& url)
94 {
95 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
96 // into the base proxy.
97 m_baseProxy->didDispatchPingLoader(frame, url);
98 Base::didDispatchPingLoader(frame, url);
99 }
100 virtual void willRequestResource(blink::WebFrame* frame, const blink::WebCac hedURLRequest& request)
101 {
102 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
103 // into the base proxy.
104 m_baseProxy->willRequestResource(frame, request);
105 Base::willRequestResource(frame, request);
106 }
107 virtual void didCreateDataSource(blink::WebFrame* frame, blink::WebDataSourc e* ds)
108 {
109 Base::didCreateDataSource(frame, ds);
110 }
111 virtual void willSendRequest(blink::WebFrame* frame, unsigned identifier, bl ink::WebURLRequest& request, const blink::WebURLResponse& redirectResponse)
112 {
113 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons e);
114 Base::willSendRequest(frame, identifier, request, redirectResponse);
115 }
116 virtual void didReceiveResponse(blink::WebFrame* frame, unsigned identifier, const blink::WebURLResponse& response)
117 {
118 m_baseProxy->didReceiveResponse(frame, identifier, response);
119 Base::didReceiveResponse(frame, identifier, response);
120 }
121 virtual void didChangeResourcePriority(blink::WebFrame* frame, unsigned iden tifier, const blink::WebURLRequest::Priority& priority)
122 {
123 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
124 // into the base proxy.
125 m_baseProxy->didChangeResourcePriority(frame, identifier, priority);
126 Base::didChangeResourcePriority(frame, identifier, priority);
127 }
128 virtual void didFinishResourceLoad(blink::WebFrame* frame, unsigned identifi er)
129 {
130 Base::didFinishResourceLoad(frame, identifier);
131 }
132 virtual blink::WebNavigationPolicy decidePolicyForNavigation(blink::WebFrame * frame, blink::WebDataSource::ExtraData* extraData, const blink::WebURLRequest& request, blink::WebNavigationType type, blink::WebNavigationPolicy defaultPolic y, bool isRedirect)
133 {
134 return Base::decidePolicyForNavigation(frame, extraData, request, type, defaultPolicy, isRedirect);
135 }
136 virtual bool willCheckAndDispatchMessageEvent(blink::WebFrame* sourceFrame, blink::WebFrame* targetFrame, blink::WebSecurityOrigin target, blink::WebDOMMess ageEvent event)
137 {
138 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra me, target, event))
139 return true;
140 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame, target, event);
141 }
142
143 private:
144 WebTestProxyBase* m_baseProxy;
145
146 // This is used to incrementally change code between Blink and Chromium.
147 // It is used instead of a #define and is set by layouttest_support when
148 // creating this object.
149 int m_version;
150 };
151
152 }
153
154 #endif // WebTestProxy_h
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/WebAXObjectProxy.cpp ('k') | content/shell/renderer/test_runner/WebPermissions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698