1 // Copyright 2015 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.
5 #ifndef COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_
6 #define COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_
8 #include "base/macros.h"
9 #include "components/test_runner/test_preferences.h"
10 #include "components/test_runner/web_test_delegate.h"
12 namespace test_runner
{
13 class WebTestInterfaces
;
14 class WebTestProxyBase
;
17 namespace html_viewer
{
19 class WebTestDelegateImpl
: public test_runner::WebTestDelegate
{
21 WebTestDelegateImpl();
22 ~WebTestDelegateImpl();
24 void set_test_interfaces(test_runner::WebTestInterfaces
* test_interfaces
) {
25 test_interfaces_
= test_interfaces
;
27 void set_test_proxy(test_runner::WebTestProxyBase
* proxy
) {
32 // From test_runner::WebTestDelegate:
33 void ClearEditCommand() override
;
34 void SetEditCommand(const std::string
& name
,
35 const std::string
& value
) override
;
36 void SetGamepadProvider(test_runner::GamepadController
* controller
) override
;
37 void SetDeviceLightData(const double data
) override
;
38 void SetDeviceMotionData(const blink::WebDeviceMotionData
& data
) override
;
39 void SetDeviceOrientationData(
40 const blink::WebDeviceOrientationData
& data
) override
;
41 void SetScreenOrientation(
42 const blink::WebScreenOrientationType
& orientation
) override
;
43 void ResetScreenOrientation() override
;
44 void DidChangeBatteryStatus(const blink::WebBatteryStatus
& status
) override
;
45 void PrintMessage(const std::string
& message
) override
;
46 void PostTask(test_runner::WebTask
* task
) override
;
47 void PostDelayedTask(test_runner::WebTask
* task
, long long ms
) override
;
48 blink::WebString
RegisterIsolatedFileSystem(
49 const blink::WebVector
<blink::WebString
>& absolute_filenames
) override
;
50 long long GetCurrentTimeInMillisecond() override
;
51 blink::WebString
GetAbsoluteWebStringFromUTF8Path(
52 const std::string
& path
) override
;
53 blink::WebURL
LocalFileToDataURL(const blink::WebURL
& file_url
) override
;
54 blink::WebURL
RewriteLayoutTestsURL(const std::string
& utf8_url
) override
;
55 test_runner::TestPreferences
* Preferences() override
;
56 void ApplyPreferences() override
;
57 void UseUnfortunateSynchronousResizeMode(bool enable
) override
;
58 void EnableAutoResizeMode(const blink::WebSize
& min_size
,
59 const blink::WebSize
& max_size
) override
;
60 void DisableAutoResizeMode(const blink::WebSize
& new_size
) override
;
61 void ClearDevToolsLocalStorage() override
;
62 void ShowDevTools(const std::string
& settings
,
63 const std::string
& frontend_url
) override
;
64 void CloseDevTools() override
;
65 void EvaluateInWebInspector(long call_id
, const std::string
& script
) override
;
66 void ClearAllDatabases() override
;
67 void SetDatabaseQuota(int quota
) override
;
68 void SimulateWebNotificationClick(const std::string
& title
,
69 int action_index
) override
;
70 void SetDeviceScaleFactor(float factor
) override
;
71 void SetDeviceColorProfile(const std::string
& name
) override
;
72 void SetBluetoothMockDataSet(const std::string
& data_set
) override
;
73 void SetGeofencingMockProvider(bool service_available
) override
;
74 void ClearGeofencingMockProvider() override
;
75 void SetGeofencingMockPosition(double latitude
, double longitude
) override
;
76 void SetFocus(test_runner::WebTestProxyBase
* proxy
, bool focus
) override
;
77 void SetAcceptAllCookies(bool accept
) override
;
78 std::string
PathToLocalResource(const std::string
& resource
) override
;
79 void SetLocale(const std::string
& locale
) override
;
80 void TestFinished() override
;
81 void CloseRemainingWindows() override
;
82 void DeleteAllCookies() override
;
83 int NavigationEntryCount() override
;
84 void GoToOffset(int offset
) override
;
85 void Reload() override
;
86 void LoadURLForFrame(const blink::WebURL
& url
,
87 const std::string
& frame_name
) override
;
88 bool AllowExternalPages() override
;
89 std::string
DumpHistoryForWindow(
90 test_runner::WebTestProxyBase
* proxy
) override
;
94 const base::Callback
<void(const blink::WebURLResponse
& response
,
95 const std::string
& data
)>& callback
) override
;
96 void SetPermission(const std::string
& permission_name
,
97 const std::string
& permission_value
,
99 const GURL
& embedding_origin
) override
;
100 void ResetPermissions() override
;
101 scoped_refptr
<cc::TextureLayer
> CreateTextureLayerForMailbox(
102 cc::TextureLayerClient
* client
) override
;
103 blink::WebLayer
* InstantiateWebLayer(
104 scoped_refptr
<cc::TextureLayer
> layer
) override
;
105 cc::SharedBitmapManager
* GetSharedBitmapManager() override
;
106 void DispatchBeforeInstallPromptEvent(
108 const std::vector
<std::string
>& event_platforms
,
109 const base::Callback
<void(bool)>& callback
) override
;
110 void ResolveBeforeInstallPromptPromise(int request_id
,
111 const std::string
& platform
) override
;
112 blink::WebPlugin
* CreatePluginPlaceholder(
113 blink::WebLocalFrame
* frame
,
114 const blink::WebPluginParams
& params
) override
;
116 test_runner::TestPreferences prefs_
;
117 test_runner::WebTestInterfaces
* test_interfaces_
;
118 test_runner::WebTestProxyBase
* proxy_
;
120 DISALLOW_COPY_AND_ASSIGN(WebTestDelegateImpl
);
123 } // namespace html_viewer
125 #endif // COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_