Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / components / html_viewer / web_test_delegate_impl.cc
blob6a62f974cc07b1018d29d1d6aa5d24cd8135fd35
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 #include "components/html_viewer/web_test_delegate_impl.h"
7 #include <iostream>
9 #include "base/time/time.h"
10 #include "cc/layers/texture_layer.h"
11 #include "components/test_runner/web_task.h"
12 #include "components/test_runner/web_test_interfaces.h"
13 #include "components/test_runner/web_test_proxy.h"
14 #include "third_party/WebKit/public/platform/Platform.h"
15 #include "third_party/WebKit/public/platform/WebString.h"
16 #include "third_party/WebKit/public/platform/WebTaskRunner.h"
17 #include "third_party/WebKit/public/platform/WebThread.h"
18 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
19 #include "third_party/WebKit/public/platform/WebURL.h"
20 #include "url/gurl.h"
22 namespace html_viewer {
24 namespace {
26 class InvokeTaskHelper : public blink::WebTaskRunner::Task {
27 public:
28 InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task)
29 : task_(task.Pass()) {}
31 // WebThread::Task implementation:
32 void run() override { task_->run(); }
34 private:
35 scoped_ptr<test_runner::WebTask> task_;
38 } // namespace
40 WebTestDelegateImpl::WebTestDelegateImpl()
41 : test_interfaces_(nullptr), proxy_(nullptr) {
44 WebTestDelegateImpl::~WebTestDelegateImpl() {
47 void WebTestDelegateImpl::ClearEditCommand() {
48 NOTIMPLEMENTED();
51 void WebTestDelegateImpl::SetEditCommand(const std::string& name,
52 const std::string& value) {
53 NOTIMPLEMENTED();
56 void WebTestDelegateImpl::SetGamepadProvider(
57 test_runner::GamepadController* controller) {
58 NOTIMPLEMENTED();
61 void WebTestDelegateImpl::SetDeviceLightData(const double data) {
62 NOTIMPLEMENTED();
65 void WebTestDelegateImpl::SetDeviceMotionData(
66 const blink::WebDeviceMotionData& data) {
67 NOTIMPLEMENTED();
70 void WebTestDelegateImpl::SetDeviceOrientationData(
71 const blink::WebDeviceOrientationData& data) {
72 NOTIMPLEMENTED();
75 void WebTestDelegateImpl::SetScreenOrientation(
76 const blink::WebScreenOrientationType& orientation) {
77 NOTIMPLEMENTED();
80 void WebTestDelegateImpl::ResetScreenOrientation() {
81 NOTIMPLEMENTED();
84 void WebTestDelegateImpl::DidChangeBatteryStatus(
85 const blink::WebBatteryStatus& status) {
86 NOTIMPLEMENTED();
89 void WebTestDelegateImpl::PrintMessage(const std::string& message) {
90 std::cout << message;
93 void WebTestDelegateImpl::PostTask(test_runner::WebTask* task) {
94 blink::Platform::current()->currentThread()->taskRunner()->postTask(
95 blink::WebTraceLocation(__FUNCTION__, __FILE__),
96 new InvokeTaskHelper(make_scoped_ptr(task)));
99 void WebTestDelegateImpl::PostDelayedTask(test_runner::WebTask* task,
100 long long ms) {
101 blink::Platform::current()->currentThread()->taskRunner()->postDelayedTask(
102 blink::WebTraceLocation(__FUNCTION__, __FILE__),
103 new InvokeTaskHelper(make_scoped_ptr(task)), ms);
106 blink::WebString WebTestDelegateImpl::RegisterIsolatedFileSystem(
107 const blink::WebVector<blink::WebString>& absolute_filenames) {
108 NOTIMPLEMENTED();
109 return blink::WebString();
112 long long WebTestDelegateImpl::GetCurrentTimeInMillisecond() {
113 return base::TimeDelta(base::Time::Now() - base::Time::UnixEpoch())
114 .ToInternalValue() /
115 base::Time::kMicrosecondsPerMillisecond;
118 blink::WebString WebTestDelegateImpl::GetAbsoluteWebStringFromUTF8Path(
119 const std::string& path) {
120 NOTIMPLEMENTED();
121 return blink::WebString::fromUTF8(path);
124 blink::WebURL WebTestDelegateImpl::LocalFileToDataURL(
125 const blink::WebURL& file_url) {
126 NOTIMPLEMENTED();
127 return blink::WebURL();
130 blink::WebURL WebTestDelegateImpl::RewriteLayoutTestsURL(
131 const std::string& utf8_url) {
132 return blink::WebURL(GURL(utf8_url));
135 test_runner::TestPreferences* WebTestDelegateImpl::Preferences() {
136 return &prefs_;
139 void WebTestDelegateImpl::ApplyPreferences() {
140 NOTIMPLEMENTED();
143 void WebTestDelegateImpl::UseUnfortunateSynchronousResizeMode(bool enable) {
144 NOTIMPLEMENTED();
147 void WebTestDelegateImpl::EnableAutoResizeMode(const blink::WebSize& min_size,
148 const blink::WebSize& max_size) {
149 NOTIMPLEMENTED();
152 void WebTestDelegateImpl::DisableAutoResizeMode(
153 const blink::WebSize& new_size) {
154 NOTIMPLEMENTED();
157 void WebTestDelegateImpl::ClearDevToolsLocalStorage() {
158 NOTIMPLEMENTED();
161 void WebTestDelegateImpl::ShowDevTools(const std::string& settings,
162 const std::string& frontend_url) {
163 NOTIMPLEMENTED();
166 void WebTestDelegateImpl::CloseDevTools() {
167 NOTIMPLEMENTED();
170 void WebTestDelegateImpl::EvaluateInWebInspector(long call_id,
171 const std::string& script) {
172 NOTIMPLEMENTED();
175 void WebTestDelegateImpl::ClearAllDatabases() {
176 NOTIMPLEMENTED();
179 void WebTestDelegateImpl::SetDatabaseQuota(int quota) {
180 NOTIMPLEMENTED();
183 void WebTestDelegateImpl::SimulateWebNotificationClick(
184 const std::string& title, int action_index) {
185 NOTIMPLEMENTED();
188 void WebTestDelegateImpl::SetDeviceScaleFactor(float factor) {
189 NOTIMPLEMENTED();
192 void WebTestDelegateImpl::SetDeviceColorProfile(const std::string& name) {
193 NOTIMPLEMENTED();
196 void WebTestDelegateImpl::SetBluetoothMockDataSet(const std::string& data_set) {
197 NOTIMPLEMENTED();
200 void WebTestDelegateImpl::SetBluetoothManualChooser() {
201 NOTIMPLEMENTED();
204 std::vector<std::string>
205 WebTestDelegateImpl::GetBluetoothManualChooserEvents() {
206 NOTIMPLEMENTED();
207 return std::vector<std::string>();
210 void WebTestDelegateImpl::SendBluetoothManualChooserEvent(
211 const std::string& event,
212 const std::string& argument) {
213 NOTIMPLEMENTED();
216 void WebTestDelegateImpl::SetGeofencingMockProvider(bool service_available) {
217 NOTIMPLEMENTED();
220 void WebTestDelegateImpl::ClearGeofencingMockProvider() {
221 NOTIMPLEMENTED();
224 void WebTestDelegateImpl::SetGeofencingMockPosition(double latitude,
225 double longitude) {
226 NOTIMPLEMENTED();
229 void WebTestDelegateImpl::SetFocus(test_runner::WebTestProxyBase* proxy,
230 bool focus) {
231 NOTIMPLEMENTED();
234 void WebTestDelegateImpl::SetAcceptAllCookies(bool accept) {
235 NOTIMPLEMENTED();
238 std::string WebTestDelegateImpl::PathToLocalResource(
239 const std::string& resource) {
240 NOTIMPLEMENTED();
241 return std::string();
244 void WebTestDelegateImpl::SetLocale(const std::string& locale) {
245 NOTIMPLEMENTED();
248 void WebTestDelegateImpl::TestFinished() {
249 std::cout << "Content-Type: text/plain\n";
250 std::cout << proxy_->CaptureTree(false, false);
251 std::cout << "#EOF\n";
253 test_interfaces_->SetTestIsRunning(false);
254 if (!completion_callback_.is_null())
255 completion_callback_.Run();
258 void WebTestDelegateImpl::CloseRemainingWindows() {
259 NOTIMPLEMENTED();
262 void WebTestDelegateImpl::DeleteAllCookies() {
263 NOTIMPLEMENTED();
266 int WebTestDelegateImpl::NavigationEntryCount() {
267 NOTIMPLEMENTED();
268 return 0;
271 void WebTestDelegateImpl::GoToOffset(int offset) {
272 NOTIMPLEMENTED();
275 void WebTestDelegateImpl::Reload() {
276 NOTIMPLEMENTED();
279 void WebTestDelegateImpl::LoadURLForFrame(const blink::WebURL& url,
280 const std::string& frame_name) {
281 NOTIMPLEMENTED();
284 bool WebTestDelegateImpl::AllowExternalPages() {
285 NOTIMPLEMENTED();
286 return false;
289 std::string WebTestDelegateImpl::DumpHistoryForWindow(
290 test_runner::WebTestProxyBase* proxy) {
291 NOTIMPLEMENTED();
292 return std::string();
295 void WebTestDelegateImpl::FetchManifest(
296 blink::WebView* view,
297 const GURL& url,
298 const base::Callback<void(const blink::WebURLResponse& response,
299 const std::string& data)>& callback) {
300 NOTIMPLEMENTED();
303 void WebTestDelegateImpl::SetPermission(const std::string& permission_name,
304 const std::string& permission_value,
305 const GURL& origin,
306 const GURL& embedding_origin) {
307 NOTIMPLEMENTED();
310 void WebTestDelegateImpl::ResetPermissions() {
311 NOTIMPLEMENTED();
314 cc::SharedBitmapManager* WebTestDelegateImpl::GetSharedBitmapManager() {
315 NOTIMPLEMENTED();
316 return nullptr;
319 void WebTestDelegateImpl::DispatchBeforeInstallPromptEvent(
320 int request_id,
321 const std::vector<std::string>& event_platforms,
322 const base::Callback<void(bool)>& callback) {
323 NOTIMPLEMENTED();
326 void WebTestDelegateImpl::ResolveBeforeInstallPromptPromise(int request_id,
327 const std::string& platform) {
328 NOTIMPLEMENTED();
331 blink::WebPlugin* WebTestDelegateImpl::CreatePluginPlaceholder(
332 blink::WebLocalFrame* frame,
333 const blink::WebPluginParams& params) {
334 NOTIMPLEMENTED();
335 return nullptr;
338 void WebTestDelegateImpl::OnWebTestProxyBaseDestroy(
339 test_runner::WebTestProxyBase* base) {
342 } // namespace html_viewer