ui: Stop converting Rect to RectF implicitly in native_theme_win.cc
[chromium-blink-merge.git] / components / html_viewer / web_test_delegate_impl.cc
blob613420a57167b81c82564d2c772c012ce18b884a
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 "base/time/time.h"
8 #include "cc/layers/texture_layer.h"
9 #include "components/test_runner/web_task.h"
10 #include "components/test_runner/web_test_interfaces.h"
11 #include "components/test_runner/web_test_proxy.h"
12 #include "third_party/WebKit/public/platform/Platform.h"
13 #include "third_party/WebKit/public/platform/WebString.h"
14 #include "third_party/WebKit/public/platform/WebTaskRunner.h"
15 #include "third_party/WebKit/public/platform/WebThread.h"
16 #include "third_party/WebKit/public/platform/WebTraceLocation.h"
17 #include "third_party/WebKit/public/platform/WebURL.h"
18 #include "url/gurl.h"
20 namespace html_viewer {
22 namespace {
24 class InvokeTaskHelper : public blink::WebTaskRunner::Task {
25 public:
26 InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task)
27 : task_(task.Pass()) {}
29 // WebThread::Task implementation:
30 void run() override { task_->run(); }
32 private:
33 scoped_ptr<test_runner::WebTask> task_;
36 } // namespace
38 WebTestDelegateImpl::WebTestDelegateImpl()
39 : test_interfaces_(nullptr), proxy_(nullptr) {
42 WebTestDelegateImpl::~WebTestDelegateImpl() {
45 void WebTestDelegateImpl::ClearEditCommand() {
46 NOTIMPLEMENTED();
49 void WebTestDelegateImpl::SetEditCommand(const std::string& name,
50 const std::string& value) {
51 NOTIMPLEMENTED();
54 void WebTestDelegateImpl::SetGamepadProvider(
55 test_runner::GamepadController* controller) {
56 NOTIMPLEMENTED();
59 void WebTestDelegateImpl::SetDeviceLightData(const double data) {
60 NOTIMPLEMENTED();
63 void WebTestDelegateImpl::SetDeviceMotionData(
64 const blink::WebDeviceMotionData& data) {
65 NOTIMPLEMENTED();
68 void WebTestDelegateImpl::SetDeviceOrientationData(
69 const blink::WebDeviceOrientationData& data) {
70 NOTIMPLEMENTED();
73 void WebTestDelegateImpl::SetScreenOrientation(
74 const blink::WebScreenOrientationType& orientation) {
75 NOTIMPLEMENTED();
78 void WebTestDelegateImpl::ResetScreenOrientation() {
79 NOTIMPLEMENTED();
82 void WebTestDelegateImpl::DidChangeBatteryStatus(
83 const blink::WebBatteryStatus& status) {
84 NOTIMPLEMENTED();
87 void WebTestDelegateImpl::PrintMessage(const std::string& message) {
88 fprintf(stderr, "%s", message.c_str());
91 void WebTestDelegateImpl::PostTask(test_runner::WebTask* task) {
92 blink::Platform::current()->currentThread()->taskRunner()->postTask(
93 blink::WebTraceLocation(__FUNCTION__, __FILE__),
94 new InvokeTaskHelper(make_scoped_ptr(task)));
97 void WebTestDelegateImpl::PostDelayedTask(test_runner::WebTask* task,
98 long long ms) {
99 blink::Platform::current()->currentThread()->taskRunner()->postDelayedTask(
100 blink::WebTraceLocation(__FUNCTION__, __FILE__),
101 new InvokeTaskHelper(make_scoped_ptr(task)), ms);
104 blink::WebString WebTestDelegateImpl::RegisterIsolatedFileSystem(
105 const blink::WebVector<blink::WebString>& absolute_filenames) {
106 NOTIMPLEMENTED();
107 return blink::WebString();
110 long long WebTestDelegateImpl::GetCurrentTimeInMillisecond() {
111 return base::TimeDelta(base::Time::Now() - base::Time::UnixEpoch())
112 .ToInternalValue() /
113 base::Time::kMicrosecondsPerMillisecond;
116 blink::WebString WebTestDelegateImpl::GetAbsoluteWebStringFromUTF8Path(
117 const std::string& path) {
118 NOTIMPLEMENTED();
119 return blink::WebString::fromUTF8(path);
122 blink::WebURL WebTestDelegateImpl::LocalFileToDataURL(
123 const blink::WebURL& file_url) {
124 NOTIMPLEMENTED();
125 return blink::WebURL();
128 blink::WebURL WebTestDelegateImpl::RewriteLayoutTestsURL(
129 const std::string& utf8_url) {
130 return blink::WebURL(GURL(utf8_url));
133 test_runner::TestPreferences* WebTestDelegateImpl::Preferences() {
134 return &prefs_;
137 void WebTestDelegateImpl::ApplyPreferences() {
138 NOTIMPLEMENTED();
141 void WebTestDelegateImpl::UseUnfortunateSynchronousResizeMode(bool enable) {
142 NOTIMPLEMENTED();
145 void WebTestDelegateImpl::EnableAutoResizeMode(const blink::WebSize& min_size,
146 const blink::WebSize& max_size) {
147 NOTIMPLEMENTED();
150 void WebTestDelegateImpl::DisableAutoResizeMode(
151 const blink::WebSize& new_size) {
152 NOTIMPLEMENTED();
155 void WebTestDelegateImpl::ClearDevToolsLocalStorage() {
156 NOTIMPLEMENTED();
159 void WebTestDelegateImpl::ShowDevTools(const std::string& settings,
160 const std::string& frontend_url) {
161 NOTIMPLEMENTED();
164 void WebTestDelegateImpl::CloseDevTools() {
165 NOTIMPLEMENTED();
168 void WebTestDelegateImpl::EvaluateInWebInspector(long call_id,
169 const std::string& script) {
170 NOTIMPLEMENTED();
173 void WebTestDelegateImpl::ClearAllDatabases() {
174 NOTIMPLEMENTED();
177 void WebTestDelegateImpl::SetDatabaseQuota(int quota) {
178 NOTIMPLEMENTED();
181 void WebTestDelegateImpl::SimulateWebNotificationClick(
182 const std::string& title, int action_index) {
183 NOTIMPLEMENTED();
186 void WebTestDelegateImpl::SetDeviceScaleFactor(float factor) {
187 NOTIMPLEMENTED();
190 void WebTestDelegateImpl::SetDeviceColorProfile(const std::string& name) {
191 NOTIMPLEMENTED();
194 void WebTestDelegateImpl::SetBluetoothMockDataSet(const std::string& data_set) {
195 NOTIMPLEMENTED();
198 void WebTestDelegateImpl::SetGeofencingMockProvider(bool service_available) {
199 NOTIMPLEMENTED();
202 void WebTestDelegateImpl::ClearGeofencingMockProvider() {
203 NOTIMPLEMENTED();
206 void WebTestDelegateImpl::SetGeofencingMockPosition(double latitude,
207 double longitude) {
208 NOTIMPLEMENTED();
211 void WebTestDelegateImpl::SetFocus(test_runner::WebTestProxyBase* proxy,
212 bool focus) {
213 NOTIMPLEMENTED();
216 void WebTestDelegateImpl::SetAcceptAllCookies(bool accept) {
217 NOTIMPLEMENTED();
220 std::string WebTestDelegateImpl::PathToLocalResource(
221 const std::string& resource) {
222 NOTIMPLEMENTED();
223 return std::string();
226 void WebTestDelegateImpl::SetLocale(const std::string& locale) {
227 NOTIMPLEMENTED();
230 void WebTestDelegateImpl::TestFinished() {
231 test_interfaces_->SetTestIsRunning(false);
232 fprintf(stderr, "%s", proxy_ ? proxy_->CaptureTree(false, false).c_str()
233 : dump_tree_.c_str());
236 void WebTestDelegateImpl::CloseRemainingWindows() {
237 NOTIMPLEMENTED();
240 void WebTestDelegateImpl::DeleteAllCookies() {
241 NOTIMPLEMENTED();
244 int WebTestDelegateImpl::NavigationEntryCount() {
245 NOTIMPLEMENTED();
246 return 0;
249 void WebTestDelegateImpl::GoToOffset(int offset) {
250 NOTIMPLEMENTED();
253 void WebTestDelegateImpl::Reload() {
254 NOTIMPLEMENTED();
257 void WebTestDelegateImpl::LoadURLForFrame(const blink::WebURL& url,
258 const std::string& frame_name) {
259 NOTIMPLEMENTED();
262 bool WebTestDelegateImpl::AllowExternalPages() {
263 NOTIMPLEMENTED();
264 return false;
267 std::string WebTestDelegateImpl::DumpHistoryForWindow(
268 test_runner::WebTestProxyBase* proxy) {
269 NOTIMPLEMENTED();
270 return std::string();
273 void WebTestDelegateImpl::FetchManifest(
274 blink::WebView* view,
275 const GURL& url,
276 const base::Callback<void(const blink::WebURLResponse& response,
277 const std::string& data)>& callback) {
278 NOTIMPLEMENTED();
281 void WebTestDelegateImpl::SetPermission(const std::string& permission_name,
282 const std::string& permission_value,
283 const GURL& origin,
284 const GURL& embedding_origin) {
285 NOTIMPLEMENTED();
288 void WebTestDelegateImpl::ResetPermissions() {
289 NOTIMPLEMENTED();
292 cc::SharedBitmapManager* WebTestDelegateImpl::GetSharedBitmapManager() {
293 NOTIMPLEMENTED();
294 return nullptr;
297 void WebTestDelegateImpl::DispatchBeforeInstallPromptEvent(
298 int request_id,
299 const std::vector<std::string>& event_platforms,
300 const base::Callback<void(bool)>& callback) {
301 NOTIMPLEMENTED();
304 void WebTestDelegateImpl::ResolveBeforeInstallPromptPromise(int request_id,
305 const std::string& platform) {
306 NOTIMPLEMENTED();
309 blink::WebPlugin* WebTestDelegateImpl::CreatePluginPlaceholder(
310 blink::WebLocalFrame* frame,
311 const blink::WebPluginParams& params) {
312 NOTIMPLEMENTED();
313 return nullptr;
316 void WebTestDelegateImpl::OnWebTestProxyBaseDestroy(
317 test_runner::WebTestProxyBase* base) {
318 DCHECK_EQ(proxy_, base);
319 dump_tree_ = proxy_->CaptureTree(false, false);
320 proxy_ = nullptr;
323 } // namespace html_viewer