blob: 4f37c31463d8657777093acefee351ea467a68fe [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 {
benwells0c0d3f12015-05-25 01:03:1715class WebAppBannerClient;
abhishek.a21bdd07a82014-09-25 06:34:1016class WebAudioDevice;
17class WebFrame;
lukaszafd124602016-04-01 16:53:3018class WebFrameClient;
abhishek.a21bdd07a82014-09-25 06:34:1019class WebMediaStreamCenter;
20class WebMediaStreamCenterClient;
21class WebMIDIAccessor;
22class WebMIDIAccessorClient;
23class WebRTCPeerConnectionHandler;
24class WebRTCPeerConnectionHandlerClient;
25class WebThemeEngine;
26class WebURL;
27class WebView;
28}
29
jochenf5f31752015-06-03 12:06:3430namespace test_runner {
abhishek.a21bdd07a82014-09-25 06:34:1031
jochen746754c52015-06-05 16:40:4132class AppBannerClient;
abhishek.a21bdd07a82014-09-25 06:34:1033class TestInterfaces;
lukaszafd124602016-04-01 16:53:3034class WebFrameTestClient;
japhet7fc9d872016-05-04 17:02:5035class WebFrameTestProxyBase;
abhishek.a21bdd07a82014-09-25 06:34:1036class WebTestDelegate;
37class WebTestProxyBase;
38class WebTestRunner;
lukasza01da2602016-04-05 14:51:2639class WebViewTestClient;
lukaszadf92022f2016-05-03 16:42:3140class WebWidgetTestClient;
abhishek.a21bdd07a82014-09-25 06:34:1041
jochen746754c52015-06-05 16:40:4142class TEST_RUNNER_EXPORT WebTestInterfaces {
abhishek.a21bdd07a82014-09-25 06:34:1043 public:
44 WebTestInterfaces();
45 ~WebTestInterfaces();
46
lukasza8973c522016-04-27 16:32:2847 void SetMainView(blink::WebView* web_view);
abhishek.a21bdd07a82014-09-25 06:34:1048 void SetDelegate(WebTestDelegate* delegate);
abhishek.a21bdd07a82014-09-25 06:34:1049 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
dcheng82beb4f2016-04-26 00:35:0267 std::unique_ptr<blink::WebAppBannerClient> CreateAppBannerClient();
benwells0c0d3f12015-05-25 01:03:1768
abhishek.a21bdd07a82014-09-25 06:34:1069 TestInterfaces* GetTestInterfaces();
70
lukasza01da2602016-04-05 14:51:2671 // 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
lukasza335bb762016-04-22 16:44:0374 // of WebTestInterfaces and/or the lifetime of |web_test_proxy_base|.
dcheng82beb4f2016-04-26 00:35:0275 std::unique_ptr<WebFrameTestClient> CreateWebFrameTestClient(
japhet7fc9d872016-05-04 17:02:5076 WebTestProxyBase* web_test_proxy_base,
77 WebFrameTestProxyBase* web_frame_test_proxy_base);
lukasza01da2602016-04-05 14:51:2678
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|.
dcheng82beb4f2016-04-26 00:35:0283 std::unique_ptr<WebViewTestClient> CreateWebViewTestClient(
lukasza01da2602016-04-05 14:51:2684 WebTestProxyBase* web_test_proxy_base);
lukaszafd124602016-04-01 16:53:3085
lukaszadf92022f2016-05-03 16:42:3186 // 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
lukasza7ab191b2016-04-14 22:43:2593 // Gets a list of currently opened windows created by the current test.
94 std::vector<blink::WebView*> GetWindowList();
95
abhishek.a21bdd07a82014-09-25 06:34:1096 private:
dcheng82beb4f2016-04-26 00:35:0297 std::unique_ptr<TestInterfaces> interfaces_;
abhishek.a21bdd07a82014-09-25 06:34:1098
99 DISALLOW_COPY_AND_ASSIGN(WebTestInterfaces);
100};
101
jochenf5f31752015-06-03 12:06:34102} // namespace test_runner
abhishek.a21bdd07a82014-09-25 06:34:10103
jochen73e711c2015-06-03 10:01:46104#endif // COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_