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

Side by Side Diff: content/public/test/layout_tests/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 /*
6 * Copyright (C) 2013 Google Inc. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Google Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
abarth-chromium 2013/12/19 17:42:07 I believe you can remove these license blocks when
34
35 #ifndef WebFrameTestProxy_h
36 #define WebFrameTestProxy_h
37
38 #include "content/public/test/layout_tests/WebTestProxy.h"
39 #include "third_party/WebKit/public/platform/WebNonCopyable.h"
40
41 namespace WebTestRunner {
42
43 // Templetized wrapper around RenderFrameImpl objects, which implement
44 // the WebFrameClient interface.
45 template<class Base, typename P, typename R>
46 class WebFrameTestProxy : public Base, public blink::WebNonCopyable {
47 public:
48 WebFrameTestProxy(P p, R r)
49 : Base(p, r)
50 , m_baseProxy(0)
51 , m_version(0) { }
52
53 virtual ~WebFrameTestProxy() { }
54
55 void setBaseProxy(WebTestProxyBase* proxy)
56 {
57 m_baseProxy = proxy;
58 }
59
60 void setVersion(int version)
61 {
62 m_version = version;
63 }
64
65 blink::WebPlugin* createPlugin(blink::WebFrame* frame, const blink::WebPlugi nParams& params)
66 {
67 blink::WebPlugin* plugin = m_baseProxy->createPlugin(frame, params);
68 if (plugin)
69 return plugin;
70 return Base::createPlugin(frame, params);
71 }
72
73 // WebFrameClient implementation.
74 virtual void didStartProvisionalLoad(blink::WebFrame* frame)
75 {
76 if (m_version > 2)
77 m_baseProxy->didStartProvisionalLoad(frame);
78 Base::didStartProvisionalLoad(frame);
79 }
80 virtual void didReceiveServerRedirectForProvisionalLoad(blink::WebFrame* fra me)
81 {
82 Base::didReceiveServerRedirectForProvisionalLoad(frame);
83 }
84 virtual void didFailProvisionalLoad(blink::WebFrame* frame, const blink::Web URLError& error)
85 {
86 Base::didFailProvisionalLoad(frame, error);
87 }
88 virtual void didCommitProvisionalLoad(blink::WebFrame* frame, bool isNewNavi gation)
89 {
90 Base::didCommitProvisionalLoad(frame, isNewNavigation);
91 }
92 virtual void didReceiveTitle(blink::WebFrame* frame, const blink::WebString& title, blink::WebTextDirection direction)
93 {
94 Base::didReceiveTitle(frame, title, direction);
95 }
96 virtual void didChangeIcon(blink::WebFrame* frame, blink::WebIconURL::Type i conType)
97 {
98 Base::didChangeIcon(frame, iconType);
99 }
100 virtual void didFinishDocumentLoad(blink::WebFrame* frame)
101 {
102 Base::didFinishDocumentLoad(frame);
103 }
104 virtual void didHandleOnloadEvents(blink::WebFrame* frame)
105 {
106 Base::didHandleOnloadEvents(frame);
107 }
108 virtual void didFailLoad(blink::WebFrame* frame, const blink::WebURLError& e rror)
109 {
110 Base::didFailLoad(frame, error);
111 }
112 virtual void didFinishLoad(blink::WebFrame* frame)
113 {
114 Base::didFinishLoad(frame);
115 }
116 virtual void didDetectXSS(blink::WebFrame* frame, const blink::WebURL& insec ureURL, bool didBlockEntirePage)
117 {
118 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
119 // into the base proxy.
120 m_baseProxy->didDetectXSS(frame, insecureURL, didBlockEntirePage);
121 Base::didDetectXSS(frame, insecureURL, didBlockEntirePage);
122 }
123 virtual void didDispatchPingLoader(blink::WebFrame* frame, const blink::WebU RL& url)
124 {
125 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
126 // into the base proxy.
127 m_baseProxy->didDispatchPingLoader(frame, url);
128 Base::didDispatchPingLoader(frame, url);
129 }
130 virtual void willRequestResource(blink::WebFrame* frame, const blink::WebCac hedURLRequest& request)
131 {
132 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
133 // into the base proxy.
134 m_baseProxy->willRequestResource(frame, request);
135 Base::willRequestResource(frame, request);
136 }
137 virtual void didCreateDataSource(blink::WebFrame* frame, blink::WebDataSourc e* ds)
138 {
139 Base::didCreateDataSource(frame, ds);
140 }
141 virtual void willSendRequest(blink::WebFrame* frame, unsigned identifier, bl ink::WebURLRequest& request, const blink::WebURLResponse& redirectResponse)
142 {
143 m_baseProxy->willSendRequest(frame, identifier, request, redirectRespons e);
144 Base::willSendRequest(frame, identifier, request, redirectResponse);
145 }
146 virtual void didReceiveResponse(blink::WebFrame* frame, unsigned identifier, const blink::WebURLResponse& response)
147 {
148 m_baseProxy->didReceiveResponse(frame, identifier, response);
149 Base::didReceiveResponse(frame, identifier, response);
150 }
151 virtual void didChangeResourcePriority(blink::WebFrame* frame, unsigned iden tifier, const blink::WebURLRequest::Priority& priority)
152 {
153 // This is not implemented in RenderFrameImpl, so need to explicitly cal l
154 // into the base proxy.
155 m_baseProxy->didChangeResourcePriority(frame, identifier, priority);
156 Base::didChangeResourcePriority(frame, identifier, priority);
157 }
158 virtual void didFinishResourceLoad(blink::WebFrame* frame, unsigned identifi er)
159 {
160 Base::didFinishResourceLoad(frame, identifier);
161 }
162 virtual blink::WebNavigationPolicy decidePolicyForNavigation(blink::WebFrame * frame, blink::WebDataSource::ExtraData* extraData, const blink::WebURLRequest& request, blink::WebNavigationType type, blink::WebNavigationPolicy defaultPolic y, bool isRedirect)
163 {
164 return Base::decidePolicyForNavigation(frame, extraData, request, type, defaultPolicy, isRedirect);
165 }
166 virtual bool willCheckAndDispatchMessageEvent(blink::WebFrame* sourceFrame, blink::WebFrame* targetFrame, blink::WebSecurityOrigin target, blink::WebDOMMess ageEvent event)
167 {
168 if (m_baseProxy->willCheckAndDispatchMessageEvent(sourceFrame, targetFra me, target, event))
169 return true;
170 return Base::willCheckAndDispatchMessageEvent(sourceFrame, targetFrame, target, event);
171 }
172
173 private:
174 WebTestProxyBase* m_baseProxy;
175
176 // This is used to incrementally change code between Blink and Chromium.
177 // It is used instead of a #define and is set by layouttest_support when
178 // creating this object.
179 int m_version;
180 };
181
182 }
183
184 #endif // WebTestProxy_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698