summaryrefslogtreecommitdiffstats
path: root/components/html_viewer/web_test_delegate_impl.cc
blob: 12474ec54769aed5157be30984296c6276a5bbd0 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
// Copyright 2015 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.

#include "components/html_viewer/web_test_delegate_impl.h"

#include "base/time/time.h"
#include "cc/layers/texture_layer.h"
#include "components/test_runner/web_task.h"
#include "components/test_runner/web_test_interfaces.h"
#include "components/test_runner/web_test_proxy.h"
#include "third_party/WebKit/public/platform/Platform.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebThread.h"
#include "third_party/WebKit/public/platform/WebTraceLocation.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "url/gurl.h"

namespace html_viewer {

namespace {

class InvokeTaskHelper : public blink::WebThread::Task {
 public:
  InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task)
      : task_(task.Pass()) {}

  // WebThread::Task implementation:
  void run() override { task_->run(); }

 private:
  scoped_ptr<test_runner::WebTask> task_;
};

}  // namespace

WebTestDelegateImpl::WebTestDelegateImpl()
    : test_interfaces_(nullptr), proxy_(nullptr) {
}

WebTestDelegateImpl::~WebTestDelegateImpl() {
}

void WebTestDelegateImpl::ClearEditCommand() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetEditCommand(const std::string& name,
                                     const std::string& value) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetGamepadProvider(
    test_runner::GamepadController* controller) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetDeviceLightData(const double data) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetDeviceMotionData(
    const blink::WebDeviceMotionData& data) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetDeviceOrientationData(
    const blink::WebDeviceOrientationData& data) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetScreenOrientation(
    const blink::WebScreenOrientationType& orientation) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ResetScreenOrientation() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::DidChangeBatteryStatus(
    const blink::WebBatteryStatus& status) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::PrintMessage(const std::string& message) {
  fprintf(stderr, "%s", message.c_str());
}

void WebTestDelegateImpl::PostTask(test_runner::WebTask* task) {
  blink::Platform::current()->currentThread()->postTask(
      blink::WebTraceLocation(__FUNCTION__, __FILE__),
      new InvokeTaskHelper(make_scoped_ptr(task)));
}

void WebTestDelegateImpl::PostDelayedTask(test_runner::WebTask* task,
                                          long long ms) {
  blink::Platform::current()->currentThread()->postDelayedTask(
      blink::WebTraceLocation(__FUNCTION__, __FILE__),
      new InvokeTaskHelper(make_scoped_ptr(task)), ms);
}

blink::WebString WebTestDelegateImpl::RegisterIsolatedFileSystem(
    const blink::WebVector<blink::WebString>& absolute_filenames) {
  NOTIMPLEMENTED();
  return blink::WebString();
}

long long WebTestDelegateImpl::GetCurrentTimeInMillisecond() {
  return base::TimeDelta(base::Time::Now() - base::Time::UnixEpoch())
             .ToInternalValue() /
         base::Time::kMicrosecondsPerMillisecond;
}

blink::WebString WebTestDelegateImpl::GetAbsoluteWebStringFromUTF8Path(
    const std::string& path) {
  NOTIMPLEMENTED();
  return blink::WebString::fromUTF8(path);
}

blink::WebURL WebTestDelegateImpl::LocalFileToDataURL(
    const blink::WebURL& file_url) {
  NOTIMPLEMENTED();
  return blink::WebURL();
}

blink::WebURL WebTestDelegateImpl::RewriteLayoutTestsURL(
    const std::string& utf8_url) {
  return blink::WebURL(GURL(utf8_url));
}

test_runner::TestPreferences* WebTestDelegateImpl::Preferences() {
  return &prefs_;
}

void WebTestDelegateImpl::ApplyPreferences() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::UseUnfortunateSynchronousResizeMode(bool enable) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::EnableAutoResizeMode(const blink::WebSize& min_size,
                          const blink::WebSize& max_size) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::DisableAutoResizeMode(
    const blink::WebSize& new_size) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ClearDevToolsLocalStorage() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ShowDevTools(const std::string& settings,
                                       const std::string& frontend_url) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::CloseDevTools() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::EvaluateInWebInspector(long call_id,
                                                 const std::string& script) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ClearAllDatabases() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetDatabaseQuota(int quota) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SimulateWebNotificationClick(
    const std::string& title, int action_index) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetDeviceScaleFactor(float factor) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetDeviceColorProfile(const std::string& name) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetBluetoothMockDataSet(const std::string& data_set) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetGeofencingMockProvider(bool service_available) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ClearGeofencingMockProvider() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetGeofencingMockPosition(double latitude,
                                                    double longitude) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetFocus(test_runner::WebTestProxyBase* proxy,
                                   bool focus) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetAcceptAllCookies(bool accept) {
  NOTIMPLEMENTED();
}

std::string WebTestDelegateImpl::PathToLocalResource(
    const std::string& resource) {
  NOTIMPLEMENTED();
  return std::string();
}

void WebTestDelegateImpl::SetLocale(const std::string& locale) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::TestFinished() {
  test_interfaces_->SetTestIsRunning(false);
  fprintf(stderr, "%s", proxy_->CaptureTree(false, false).c_str());
}

void WebTestDelegateImpl::CloseRemainingWindows() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::DeleteAllCookies() {
  NOTIMPLEMENTED();
}

int WebTestDelegateImpl::NavigationEntryCount() {
  NOTIMPLEMENTED();
  return 0;
}

void WebTestDelegateImpl::GoToOffset(int offset) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::Reload() {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::LoadURLForFrame(const blink::WebURL& url,
                                          const std::string& frame_name) {
  NOTIMPLEMENTED();
}

bool WebTestDelegateImpl::AllowExternalPages() {
  NOTIMPLEMENTED();
  return false;
}

std::string WebTestDelegateImpl::DumpHistoryForWindow(
    test_runner::WebTestProxyBase* proxy) {
  NOTIMPLEMENTED();
  return std::string();
}

void WebTestDelegateImpl::FetchManifest(
    blink::WebView* view,
    const GURL& url,
    const base::Callback<void(const blink::WebURLResponse& response,
                              const std::string& data)>& callback) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::SetPermission(const std::string& permission_name,
                   const std::string& permission_value,
                   const GURL& origin,
                   const GURL& embedding_origin) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ResetPermissions() {
  NOTIMPLEMENTED();
}

scoped_refptr<cc::TextureLayer>
WebTestDelegateImpl::CreateTextureLayerForMailbox(
    cc::TextureLayerClient* client) {
  NOTIMPLEMENTED();
  return nullptr;
}

blink::WebLayer* WebTestDelegateImpl::InstantiateWebLayer(
    scoped_refptr<cc::TextureLayer> layer) {
  NOTIMPLEMENTED();
  return nullptr;
}

cc::SharedBitmapManager* WebTestDelegateImpl::GetSharedBitmapManager() {
  NOTIMPLEMENTED();
  return nullptr;
}

void WebTestDelegateImpl::DispatchBeforeInstallPromptEvent(
    int request_id,
    const std::vector<std::string>& event_platforms,
    const base::Callback<void(bool)>& callback) {
  NOTIMPLEMENTED();
}

void WebTestDelegateImpl::ResolveBeforeInstallPromptPromise(int request_id,
                                       const std::string& platform) {
  NOTIMPLEMENTED();
}

blink::WebPlugin* WebTestDelegateImpl::CreatePluginPlaceholder(
    blink::WebLocalFrame* frame,
    const blink::WebPluginParams& params) {
  NOTIMPLEMENTED();
  return nullptr;
}

}  // namespace html_viewer