abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 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 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 5 | #ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_ |
| 6 | #define COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_ |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 7 | |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 8 | #include <memory> |
lukasza | 7ab191b | 2016-04-14 22:43:25 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 11 | #include "base/macros.h" |
jochen | 746754c5 | 2015-06-05 16:40:41 | [diff] [blame] | 12 | #include "components/test_runner/test_runner_export.h" |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 13 | |
| 14 | namespace blink { |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 15 | class WebAudioDevice; |
| 16 | class WebFrame; |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 17 | class WebFrameClient; |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 18 | class WebMediaStreamCenter; |
| 19 | class WebMediaStreamCenterClient; |
| 20 | class WebMIDIAccessor; |
| 21 | class WebMIDIAccessorClient; |
| 22 | class WebRTCPeerConnectionHandler; |
| 23 | class WebRTCPeerConnectionHandlerClient; |
| 24 | class WebThemeEngine; |
| 25 | class WebURL; |
| 26 | class WebView; |
| 27 | } |
| 28 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 29 | namespace test_runner { |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 30 | |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 31 | class TestInterfaces; |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 32 | class WebFrameTestClient; |
japhet | 7fc9d87 | 2016-05-04 17:02:50 | [diff] [blame] | 33 | class WebFrameTestProxyBase; |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 34 | class WebTestDelegate; |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 35 | class WebViewTestProxyBase; |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 36 | class WebWidgetTestProxyBase; |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 37 | class WebTestRunner; |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 38 | class WebViewTestClient; |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 39 | class WebWidgetTestClient; |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 40 | |
jochen | 746754c5 | 2015-06-05 16:40:41 | [diff] [blame] | 41 | class TEST_RUNNER_EXPORT WebTestInterfaces { |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 42 | public: |
| 43 | WebTestInterfaces(); |
| 44 | ~WebTestInterfaces(); |
| 45 | |
lukasza | 8973c52 | 2016-04-27 16:32:28 | [diff] [blame] | 46 | void SetMainView(blink::WebView* web_view); |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 47 | void SetDelegate(WebTestDelegate* delegate); |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 48 | void ResetAll(); |
| 49 | void SetTestIsRunning(bool running); |
| 50 | void ConfigureForTestWithURL(const blink::WebURL& test_url, |
| 51 | bool generate_pixels); |
| 52 | |
| 53 | WebTestRunner* TestRunner(); |
| 54 | blink::WebThemeEngine* ThemeEngine(); |
| 55 | |
| 56 | blink::WebMediaStreamCenter* CreateMediaStreamCenter( |
| 57 | blink::WebMediaStreamCenterClient* client); |
| 58 | blink::WebRTCPeerConnectionHandler* CreateWebRTCPeerConnectionHandler( |
| 59 | blink::WebRTCPeerConnectionHandlerClient* client); |
| 60 | |
| 61 | blink::WebMIDIAccessor* CreateMIDIAccessor( |
| 62 | blink::WebMIDIAccessorClient* client); |
| 63 | |
| 64 | blink::WebAudioDevice* CreateAudioDevice(double sample_rate); |
| 65 | |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 66 | TestInterfaces* GetTestInterfaces(); |
| 67 | |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 68 | // Creates a WebFrameClient implementation providing test behavior (i.e. |
| 69 | // forwarding javascript console output to the test harness). The caller |
| 70 | // should guarantee that the returned object won't be used beyond the lifetime |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 71 | // of WebTestInterfaces and/or the lifetime of |web_view_test_proxy_base|. |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 72 | std::unique_ptr<WebFrameTestClient> CreateWebFrameTestClient( |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 73 | WebViewTestProxyBase* web_view_test_proxy_base, |
japhet | 7fc9d87 | 2016-05-04 17:02:50 | [diff] [blame] | 74 | WebFrameTestProxyBase* web_frame_test_proxy_base); |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 75 | |
| 76 | // Creates a WebViewClient implementation providing test behavior (i.e. |
| 77 | // providing a mocked speech recognizer). The caller should guarantee that |
| 78 | // the returned pointer won't be used beyond the lifetime of WebTestInterfaces |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 79 | // and/or the lifetime of |web_view_test_proxy_base|. |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 80 | std::unique_ptr<WebViewTestClient> CreateWebViewTestClient( |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 81 | WebViewTestProxyBase* web_view_test_proxy_base); |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 82 | |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 83 | // Creates a WebWidgetClient implementation providing test behavior (i.e. |
| 84 | // providing a mocked screen orientation). The caller should guarantee that |
| 85 | // the returned pointer won't be used beyond the lifetime of WebTestInterfaces |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 86 | // and/or the lifetime of |web_widget_test_proxy_base|. |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 87 | std::unique_ptr<WebWidgetTestClient> CreateWebWidgetTestClient( |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 88 | WebWidgetTestProxyBase* web_widget_test_proxy_base); |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 89 | |
lukasza | 7ab191b | 2016-04-14 22:43:25 | [diff] [blame] | 90 | // Gets a list of currently opened windows created by the current test. |
| 91 | std::vector<blink::WebView*> GetWindowList(); |
| 92 | |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 93 | private: |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 94 | std::unique_ptr<TestInterfaces> interfaces_; |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 95 | |
| 96 | DISALLOW_COPY_AND_ASSIGN(WebTestInterfaces); |
| 97 | }; |
| 98 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 99 | } // namespace test_runner |
abhishek.a21 | bdd07a8 | 2014-09-25 06:34:10 | [diff] [blame] | 100 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 101 | #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_ |