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