OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/shell/renderer/test_runner/TestInterfaces.h" | 9 #include "content/shell/renderer/test_runner/TestInterfaces.h" |
10 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 10 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
| 11 #include "content/shell/renderer/test_runner/mock_screen_orientation_client.h" |
11 #include "content/shell/renderer/test_runner/test_runner.h" | 12 #include "content/shell/renderer/test_runner/test_runner.h" |
12 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 13 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
13 #include "content/test/test_media_stream_renderer_factory.h" | 14 #include "content/test/test_media_stream_renderer_factory.h" |
14 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 // Templetized wrapper around RenderFrameImpl objects, which implement | 19 // Templetized wrapper around RenderFrameImpl objects, which implement |
19 // the WebFrameClient interface. | 20 // the WebFrameClient interface. |
20 template <class Base, typename P, typename R> | 21 template <class Base, typename P, typename R> |
21 class WebFrameTestProxy : public Base { | 22 class WebFrameTestProxy : public Base { |
22 public: | 23 public: |
23 WebFrameTestProxy(P p, R r) : Base(p, r), base_proxy_(NULL) {} | 24 WebFrameTestProxy(P p, R r) : Base(p, r), base_proxy_(NULL) {} |
24 | 25 |
25 virtual ~WebFrameTestProxy() {} | 26 virtual ~WebFrameTestProxy() {} |
26 | 27 |
27 void set_base_proxy(WebTestProxyBase* proxy) { base_proxy_ = proxy; } | 28 void set_base_proxy(WebTestProxyBase* proxy) { base_proxy_ = proxy; } |
28 | 29 |
29 // WebFrameClient implementation. | 30 // WebFrameClient implementation. |
30 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, | 31 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame, |
31 const blink::WebPluginParams& params) { | 32 const blink::WebPluginParams& params) { |
32 blink::WebPlugin* plugin = base_proxy_->CreatePlugin(frame, params); | 33 blink::WebPlugin* plugin = base_proxy_->CreatePlugin(frame, params); |
33 if (plugin) return plugin; | 34 if (plugin) return plugin; |
34 return Base::createPlugin(frame, params); | 35 return Base::createPlugin(frame, params); |
35 } | 36 } |
36 | 37 |
| 38 virtual blink::WebScreenOrientationClient* webScreenOrientationClient() { |
| 39 return base_proxy_->GetScreenOrientationClientMock(); |
| 40 } |
| 41 |
37 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, | 42 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message, |
38 const blink::WebString& sourceName, | 43 const blink::WebString& sourceName, |
39 unsigned sourceLine, | 44 unsigned sourceLine, |
40 const blink::WebString& stackTrace) { | 45 const blink::WebString& stackTrace) { |
41 base_proxy_->DidAddMessageToConsole(message, sourceName, sourceLine); | 46 base_proxy_->DidAddMessageToConsole(message, sourceName, sourceLine); |
42 Base::didAddMessageToConsole(message, sourceName, sourceLine, stackTrace); | 47 Base::didAddMessageToConsole(message, sourceName, sourceLine, stackTrace); |
43 } | 48 } |
44 | 49 |
45 virtual bool canCreatePluginWithoutRenderer( | 50 virtual bool canCreatePluginWithoutRenderer( |
46 const blink::WebString& mimeType) { | 51 const blink::WebString& mimeType) { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 } | 288 } |
284 | 289 |
285 WebTestProxyBase* base_proxy_; | 290 WebTestProxyBase* base_proxy_; |
286 | 291 |
287 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); | 292 DISALLOW_COPY_AND_ASSIGN(WebFrameTestProxy); |
288 }; | 293 }; |
289 | 294 |
290 } // namespace content | 295 } // namespace content |
291 | 296 |
292 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ | 297 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_FRAME_TEST_PROXY_H_ |
OLD | NEW |