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
) override
;
69 void SetDeviceScaleFactor(float factor
) override
;
70 void SetDeviceColorProfile(const std::string
& name
) override
;
71 void SetBluetoothMockDataSet(const std::string
& data_set
) override
;
72 void SetGeofencingMockProvider(bool service_available
) override
;
73 void ClearGeofencingMockProvider() override
;
74 void SetGeofencingMockPosition(double latitude
, double longitude
) override
;
75 void SetFocus(test_runner::WebTestProxyBase
* proxy
, bool focus
) override
;
76 void SetAcceptAllCookies(bool accept
) override
;
77 std::string
PathToLocalResource(const std::string
& resource
) override
;
78 void SetLocale(const std::string
& locale
) override
;
79 void TestFinished() override
;
80 void CloseRemainingWindows() override
;
81 void DeleteAllCookies() override
;
82 int NavigationEntryCount() override
;
83 void GoToOffset(int offset
) override
;
84 void Reload() override
;
85 void LoadURLForFrame(const blink::WebURL
& url
,
86 const std::string
& frame_name
) override
;
87 bool AllowExternalPages() override
;
88 std::string
DumpHistoryForWindow(
89 test_runner::WebTestProxyBase
* proxy
) override
;
93 const base::Callback
<void(const blink::WebURLResponse
& response
,
94 const std::string
& data
)>& callback
) override
;
95 void SetPermission(const std::string
& permission_name
,
96 const std::string
& permission_value
,
98 const GURL
& embedding_origin
) override
;
99 void ResetPermissions() override
;
100 scoped_refptr
<cc::TextureLayer
> CreateTextureLayerForMailbox(
101 cc::TextureLayerClient
* client
) override
;
102 blink::WebLayer
* InstantiateWebLayer(
103 scoped_refptr
<cc::TextureLayer
> layer
) override
;
104 cc::SharedBitmapManager
* GetSharedBitmapManager() override
;
105 void DispatchBeforeInstallPromptEvent(
107 const std::vector
<std::string
>& event_platforms
,
108 const base::Callback
<void(bool)>& callback
) override
;
109 void ResolveBeforeInstallPromptPromise(int request_id
,
110 const std::string
& platform
) override
;
111 blink::WebPlugin
* CreatePluginPlaceholder(
112 blink::WebLocalFrame
* frame
,
113 const blink::WebPluginParams
& params
) override
;
115 test_runner::TestPreferences prefs_
;
116 test_runner::WebTestInterfaces
* test_interfaces_
;
117 test_runner::WebTestProxyBase
* proxy_
;
119 DISALLOW_COPY_AND_ASSIGN(WebTestDelegateImpl
);
122 } // namespace html_viewer
124 #endif // COMPONENTS_HTML_VIEWER_WEB_TEST_DELEGATE_IMPL_H_