File: web_test_interfaces.h

package info (click to toggle)
chromium-browser 57.0.2987.98-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 2,637,852 kB
  • ctags: 2,544,394
  • sloc: cpp: 12,815,961; ansic: 3,676,222; python: 1,147,112; asm: 526,608; java: 523,212; xml: 286,794; perl: 92,654; sh: 86,408; objc: 73,271; makefile: 27,698; cs: 18,487; yacc: 13,031; tcl: 12,957; pascal: 4,875; ml: 4,716; lex: 3,904; sql: 3,862; ruby: 1,982; lisp: 1,508; php: 1,368; exp: 404; awk: 325; csh: 117; jsp: 39; sed: 37
file content (100 lines) | stat: -rw-r--r-- 3,462 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_
#define COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_

#include <memory>
#include <vector>

#include "base/macros.h"
#include "components/test_runner/test_runner_export.h"

namespace blink {
class WebAudioDevice;
class WebFrameClient;
class WebMediaStreamCenter;
class WebMediaStreamCenterClient;
class WebMIDIAccessor;
class WebMIDIAccessorClient;
class WebRTCPeerConnectionHandler;
class WebRTCPeerConnectionHandlerClient;
class WebThemeEngine;
class WebURL;
class WebView;
}

namespace test_runner {

class TestInterfaces;
class WebFrameTestClient;
class WebFrameTestProxyBase;
class WebTestDelegate;
class WebViewTestProxyBase;
class WebWidgetTestProxyBase;
class WebTestRunner;
class WebViewTestClient;
class WebWidgetTestClient;

class TEST_RUNNER_EXPORT WebTestInterfaces {
 public:
  WebTestInterfaces();
  ~WebTestInterfaces();

  void SetMainView(blink::WebView* web_view);
  void SetDelegate(WebTestDelegate* delegate);
  void ResetAll();
  void SetTestIsRunning(bool running);
  void ConfigureForTestWithURL(const blink::WebURL& test_url,
                               bool generate_pixels);

  WebTestRunner* TestRunner();
  blink::WebThemeEngine* ThemeEngine();

  blink::WebMediaStreamCenter* CreateMediaStreamCenter(
      blink::WebMediaStreamCenterClient* client);
  blink::WebRTCPeerConnectionHandler* CreateWebRTCPeerConnectionHandler(
      blink::WebRTCPeerConnectionHandlerClient* client);

  blink::WebMIDIAccessor* CreateMIDIAccessor(
      blink::WebMIDIAccessorClient* client);

  blink::WebAudioDevice* CreateAudioDevice(double sample_rate);

  TestInterfaces* GetTestInterfaces();

  // Creates a WebFrameClient implementation providing test behavior (i.e.
  // forwarding javascript console output to the test harness).  The caller
  // should guarantee that the returned object won't be used beyond the lifetime
  // of WebTestInterfaces and/or the lifetime of |web_view_test_proxy_base|.
  std::unique_ptr<WebFrameTestClient> CreateWebFrameTestClient(
      WebViewTestProxyBase* web_view_test_proxy_base,
      WebFrameTestProxyBase* web_frame_test_proxy_base);

  // Creates a WebViewClient implementation providing test behavior (i.e.
  // providing a mocked speech recognizer).  The caller should guarantee that
  // the returned pointer won't be used beyond the lifetime of WebTestInterfaces
  // and/or the lifetime of |web_view_test_proxy_base|.
  std::unique_ptr<WebViewTestClient> CreateWebViewTestClient(
      WebViewTestProxyBase* web_view_test_proxy_base);

  // Creates a WebWidgetClient implementation providing test behavior (i.e.
  // providing a mocked screen orientation).  The caller should guarantee that
  // the returned pointer won't be used beyond the lifetime of WebTestInterfaces
  // and/or the lifetime of |web_widget_test_proxy_base|.
  std::unique_ptr<WebWidgetTestClient> CreateWebWidgetTestClient(
      WebWidgetTestProxyBase* web_widget_test_proxy_base);

  // Gets a list of currently opened windows created by the current test.
  std::vector<blink::WebView*> GetWindowList();

 private:
  std::unique_ptr<TestInterfaces> interfaces_;

  DISALLOW_COPY_AND_ASSIGN(WebTestInterfaces);
};

}  // namespace test_runner

#endif  // COMPONENTS_TEST_RUNNER_WEB_TEST_INTERFACES_H_