blob: cc84c1e57f11bc235533277dab1263121d9a1cac [file] [log] [blame]
abhishek.a21bdd07a82014-09-25 06:34:101// 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
jochen73e711c2015-06-03 10:01:465#ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_
6#define COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_
abhishek.a21bdd07a82014-09-25 06:34:107
dcheng82beb4f2016-04-26 00:35:028#include <memory>
lukasza7ab191b2016-04-14 22:43:259#include <vector>
10
avi5dd91f82015-12-25 22:30:4611#include "base/macros.h"
jochen746754c52015-06-05 16:40:4112#include "components/test_runner/test_runner_export.h"
abhishek.a21bdd07a82014-09-25 06:34:1013
14namespace blink {
abhishek.a21bdd07a82014-09-25 06:34:1015class WebAudioDevice;
16class WebFrame;
lukaszafd124602016-04-01 16:53:3017class WebFrameClient;
abhishek.a21bdd07a82014-09-25 06:34:1018class WebMediaStreamCenter;
19class WebMediaStreamCenterClient;
20class WebMIDIAccessor;
21class WebMIDIAccessorClient;
22class WebRTCPeerConnectionHandler;
23class WebRTCPeerConnectionHandlerClient;
24class WebThemeEngine;
25class WebURL;
26class WebView;
27}
28
jochenf5f31752015-06-03 12:06:3429namespace test_runner {
abhishek.a21bdd07a82014-09-25 06:34:1030
abhishek.a21bdd07a82014-09-25 06:34:1031class TestInterfaces;
lukaszafd124602016-04-01 16:53:3032class WebFrameTestClient;
japhet7fc9d872016-05-04 17:02:5033class WebFrameTestProxyBase;
abhishek.a21bdd07a82014-09-25 06:34:1034class WebTestDelegate;
lfg05e41372016-07-22 15:38:1035class WebViewTestProxyBase;
lfg1568d112016-08-30 16:06:2936class WebWidgetTestProxyBase;
abhishek.a21bdd07a82014-09-25 06:34:1037class WebTestRunner;
lukasza01da2602016-04-05 14:51:2638class WebViewTestClient;
lukaszadf92022f2016-05-03 16:42:3139class WebWidgetTestClient;
abhishek.a21bdd07a82014-09-25 06:34:1040
jochen746754c52015-06-05 16:40:4141class TEST_RUNNER_EXPORT WebTestInterfaces {
abhishek.a21bdd07a82014-09-25 06:34:1042 public:
43 WebTestInterfaces();
44 ~WebTestInterfaces();
45
lukasza8973c522016-04-27 16:32:2846 void SetMainView(blink::WebView* web_view);
abhishek.a21bdd07a82014-09-25 06:34:1047 void SetDelegate(WebTestDelegate* delegate);
abhishek.a21bdd07a82014-09-25 06:34:1048 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.a21bdd07a82014-09-25 06:34:1066 TestInterfaces* GetTestInterfaces();
67
lukasza01da2602016-04-05 14:51:2668 // 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
lfg05e41372016-07-22 15:38:1071 // of WebTestInterfaces and/or the lifetime of |web_view_test_proxy_base|.
dcheng82beb4f2016-04-26 00:35:0272 std::unique_ptr<WebFrameTestClient> CreateWebFrameTestClient(
lfg05e41372016-07-22 15:38:1073 WebViewTestProxyBase* web_view_test_proxy_base,
japhet7fc9d872016-05-04 17:02:5074 WebFrameTestProxyBase* web_frame_test_proxy_base);
lukasza01da2602016-04-05 14:51:2675
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
lfg05e41372016-07-22 15:38:1079 // and/or the lifetime of |web_view_test_proxy_base|.
dcheng82beb4f2016-04-26 00:35:0280 std::unique_ptr<WebViewTestClient> CreateWebViewTestClient(
lfg05e41372016-07-22 15:38:1081 WebViewTestProxyBase* web_view_test_proxy_base);
lukaszafd124602016-04-01 16:53:3082
lukaszadf92022f2016-05-03 16:42:3183 // 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
lfg1568d112016-08-30 16:06:2986 // and/or the lifetime of |web_widget_test_proxy_base|.
lukaszadf92022f2016-05-03 16:42:3187 std::unique_ptr<WebWidgetTestClient> CreateWebWidgetTestClient(
lfg1568d112016-08-30 16:06:2988 WebWidgetTestProxyBase* web_widget_test_proxy_base);
lukaszadf92022f2016-05-03 16:42:3189
lukasza7ab191b2016-04-14 22:43:2590 // Gets a list of currently opened windows created by the current test.
91 std::vector<blink::WebView*> GetWindowList();
92
abhishek.a21bdd07a82014-09-25 06:34:1093 private:
dcheng82beb4f2016-04-26 00:35:0294 std::unique_ptr<TestInterfaces> interfaces_;
abhishek.a21bdd07a82014-09-25 06:34:1095
96 DISALLOW_COPY_AND_ASSIGN(WebTestInterfaces);
97};
98
jochenf5f31752015-06-03 12:06:3499} // namespace test_runner
abhishek.a21bdd07a82014-09-25 06:34:10100
jochen73e711c2015-06-03 10:01:46101#endif // COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_