OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #include "components/html_viewer/web_test_delegate_impl.h" |
| 6 |
| 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/WebThread.h" |
| 15 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 16 #include "third_party/WebKit/public/platform/WebURL.h" |
| 17 #include "url/gurl.h" |
| 18 |
| 19 namespace html_viewer { |
| 20 |
| 21 namespace { |
| 22 |
| 23 class InvokeTaskHelper : public blink::WebThread::Task { |
| 24 public: |
| 25 InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) |
| 26 : task_(task.Pass()) {} |
| 27 |
| 28 // WebThread::Task implementation: |
| 29 void run() override { task_->run(); } |
| 30 |
| 31 private: |
| 32 scoped_ptr<test_runner::WebTask> task_; |
| 33 }; |
| 34 |
| 35 } // namespace |
| 36 |
| 37 WebTestDelegateImpl::WebTestDelegateImpl() |
| 38 : test_interfaces_(nullptr), proxy_(nullptr) { |
| 39 } |
| 40 |
| 41 WebTestDelegateImpl::~WebTestDelegateImpl() { |
| 42 } |
| 43 |
| 44 void WebTestDelegateImpl::ClearEditCommand() { |
| 45 NOTIMPLEMENTED(); |
| 46 } |
| 47 |
| 48 void WebTestDelegateImpl::SetEditCommand(const std::string& name, |
| 49 const std::string& value) { |
| 50 NOTIMPLEMENTED(); |
| 51 } |
| 52 |
| 53 void WebTestDelegateImpl::SetGamepadProvider( |
| 54 test_runner::GamepadController* controller) { |
| 55 NOTIMPLEMENTED(); |
| 56 } |
| 57 |
| 58 void WebTestDelegateImpl::SetDeviceLightData(const double data) { |
| 59 NOTIMPLEMENTED(); |
| 60 } |
| 61 |
| 62 void WebTestDelegateImpl::SetDeviceMotionData( |
| 63 const blink::WebDeviceMotionData& data) { |
| 64 NOTIMPLEMENTED(); |
| 65 } |
| 66 |
| 67 void WebTestDelegateImpl::SetDeviceOrientationData( |
| 68 const blink::WebDeviceOrientationData& data) { |
| 69 NOTIMPLEMENTED(); |
| 70 } |
| 71 |
| 72 void WebTestDelegateImpl::SetScreenOrientation( |
| 73 const blink::WebScreenOrientationType& orientation) { |
| 74 NOTIMPLEMENTED(); |
| 75 } |
| 76 |
| 77 void WebTestDelegateImpl::ResetScreenOrientation() { |
| 78 NOTIMPLEMENTED(); |
| 79 } |
| 80 |
| 81 void WebTestDelegateImpl::DidChangeBatteryStatus( |
| 82 const blink::WebBatteryStatus& status) { |
| 83 NOTIMPLEMENTED(); |
| 84 } |
| 85 |
| 86 void WebTestDelegateImpl::PrintMessage(const std::string& message) { |
| 87 fprintf(stderr, "%s", message.c_str()); |
| 88 } |
| 89 |
| 90 void WebTestDelegateImpl::PostTask(test_runner::WebTask* task) { |
| 91 blink::Platform::current()->currentThread()->postTask( |
| 92 blink::WebTraceLocation(__FUNCTION__, __FILE__), |
| 93 new InvokeTaskHelper(make_scoped_ptr(task))); |
| 94 } |
| 95 |
| 96 void WebTestDelegateImpl::PostDelayedTask(test_runner::WebTask* task, |
| 97 long long ms) { |
| 98 blink::Platform::current()->currentThread()->postDelayedTask( |
| 99 blink::WebTraceLocation(__FUNCTION__, __FILE__), |
| 100 new InvokeTaskHelper(make_scoped_ptr(task)), ms); |
| 101 } |
| 102 |
| 103 blink::WebString WebTestDelegateImpl::RegisterIsolatedFileSystem( |
| 104 const blink::WebVector<blink::WebString>& absolute_filenames) { |
| 105 NOTIMPLEMENTED(); |
| 106 return blink::WebString(); |
| 107 } |
| 108 |
| 109 long long WebTestDelegateImpl::GetCurrentTimeInMillisecond() { |
| 110 return base::TimeDelta(base::Time::Now() - base::Time::UnixEpoch()) |
| 111 .ToInternalValue() / |
| 112 base::Time::kMicrosecondsPerMillisecond; |
| 113 } |
| 114 |
| 115 blink::WebString WebTestDelegateImpl::GetAbsoluteWebStringFromUTF8Path( |
| 116 const std::string& path) { |
| 117 NOTIMPLEMENTED(); |
| 118 return blink::WebString::fromUTF8(path); |
| 119 } |
| 120 |
| 121 blink::WebURL WebTestDelegateImpl::LocalFileToDataURL( |
| 122 const blink::WebURL& file_url) { |
| 123 NOTIMPLEMENTED(); |
| 124 return blink::WebURL(); |
| 125 } |
| 126 |
| 127 blink::WebURL WebTestDelegateImpl::RewriteLayoutTestsURL( |
| 128 const std::string& utf8_url) { |
| 129 return blink::WebURL(GURL(utf8_url)); |
| 130 } |
| 131 |
| 132 test_runner::TestPreferences* WebTestDelegateImpl::Preferences() { |
| 133 return &prefs_; |
| 134 } |
| 135 |
| 136 void WebTestDelegateImpl::ApplyPreferences() { |
| 137 NOTIMPLEMENTED(); |
| 138 } |
| 139 |
| 140 void WebTestDelegateImpl::UseUnfortunateSynchronousResizeMode(bool enable) { |
| 141 NOTIMPLEMENTED(); |
| 142 } |
| 143 |
| 144 void WebTestDelegateImpl::EnableAutoResizeMode(const blink::WebSize& min_size, |
| 145 const blink::WebSize& max_size) { |
| 146 NOTIMPLEMENTED(); |
| 147 } |
| 148 |
| 149 void WebTestDelegateImpl::DisableAutoResizeMode( |
| 150 const blink::WebSize& new_size) { |
| 151 NOTIMPLEMENTED(); |
| 152 } |
| 153 |
| 154 void WebTestDelegateImpl::ClearDevToolsLocalStorage() { |
| 155 NOTIMPLEMENTED(); |
| 156 } |
| 157 |
| 158 void WebTestDelegateImpl::ShowDevTools(const std::string& settings, |
| 159 const std::string& frontend_url) { |
| 160 NOTIMPLEMENTED(); |
| 161 } |
| 162 |
| 163 void WebTestDelegateImpl::CloseDevTools() { |
| 164 NOTIMPLEMENTED(); |
| 165 } |
| 166 |
| 167 void WebTestDelegateImpl::EvaluateInWebInspector(long call_id, |
| 168 const std::string& script) { |
| 169 NOTIMPLEMENTED(); |
| 170 } |
| 171 |
| 172 void WebTestDelegateImpl::ClearAllDatabases() { |
| 173 NOTIMPLEMENTED(); |
| 174 } |
| 175 |
| 176 void WebTestDelegateImpl::SetDatabaseQuota(int quota) { |
| 177 NOTIMPLEMENTED(); |
| 178 } |
| 179 |
| 180 void WebTestDelegateImpl::SimulateWebNotificationClick( |
| 181 const std::string& title) { |
| 182 NOTIMPLEMENTED(); |
| 183 } |
| 184 |
| 185 void WebTestDelegateImpl::SetDeviceScaleFactor(float factor) { |
| 186 NOTIMPLEMENTED(); |
| 187 } |
| 188 |
| 189 void WebTestDelegateImpl::SetDeviceColorProfile(const std::string& name) { |
| 190 NOTIMPLEMENTED(); |
| 191 } |
| 192 |
| 193 void WebTestDelegateImpl::SetBluetoothMockDataSet(const std::string& data_set) { |
| 194 NOTIMPLEMENTED(); |
| 195 } |
| 196 |
| 197 void WebTestDelegateImpl::SetGeofencingMockProvider(bool service_available) { |
| 198 NOTIMPLEMENTED(); |
| 199 } |
| 200 |
| 201 void WebTestDelegateImpl::ClearGeofencingMockProvider() { |
| 202 NOTIMPLEMENTED(); |
| 203 } |
| 204 |
| 205 void WebTestDelegateImpl::SetGeofencingMockPosition(double latitude, |
| 206 double longitude) { |
| 207 NOTIMPLEMENTED(); |
| 208 } |
| 209 |
| 210 void WebTestDelegateImpl::SetFocus(test_runner::WebTestProxyBase* proxy, |
| 211 bool focus) { |
| 212 NOTIMPLEMENTED(); |
| 213 } |
| 214 |
| 215 void WebTestDelegateImpl::SetAcceptAllCookies(bool accept) { |
| 216 NOTIMPLEMENTED(); |
| 217 } |
| 218 |
| 219 std::string WebTestDelegateImpl::PathToLocalResource( |
| 220 const std::string& resource) { |
| 221 NOTIMPLEMENTED(); |
| 222 return std::string(); |
| 223 } |
| 224 |
| 225 void WebTestDelegateImpl::SetLocale(const std::string& locale) { |
| 226 NOTIMPLEMENTED(); |
| 227 } |
| 228 |
| 229 void WebTestDelegateImpl::TestFinished() { |
| 230 test_interfaces_->SetTestIsRunning(false); |
| 231 fprintf(stderr, "%s", proxy_->CaptureTree(false, false).c_str()); |
| 232 } |
| 233 |
| 234 void WebTestDelegateImpl::CloseRemainingWindows() { |
| 235 NOTIMPLEMENTED(); |
| 236 } |
| 237 |
| 238 void WebTestDelegateImpl::DeleteAllCookies() { |
| 239 NOTIMPLEMENTED(); |
| 240 } |
| 241 |
| 242 int WebTestDelegateImpl::NavigationEntryCount() { |
| 243 NOTIMPLEMENTED(); |
| 244 return 0; |
| 245 } |
| 246 |
| 247 void WebTestDelegateImpl::GoToOffset(int offset) { |
| 248 NOTIMPLEMENTED(); |
| 249 } |
| 250 |
| 251 void WebTestDelegateImpl::Reload() { |
| 252 NOTIMPLEMENTED(); |
| 253 } |
| 254 |
| 255 void WebTestDelegateImpl::LoadURLForFrame(const blink::WebURL& url, |
| 256 const std::string& frame_name) { |
| 257 NOTIMPLEMENTED(); |
| 258 } |
| 259 |
| 260 bool WebTestDelegateImpl::AllowExternalPages() { |
| 261 NOTIMPLEMENTED(); |
| 262 return false; |
| 263 } |
| 264 |
| 265 std::string WebTestDelegateImpl::DumpHistoryForWindow( |
| 266 test_runner::WebTestProxyBase* proxy) { |
| 267 NOTIMPLEMENTED(); |
| 268 return std::string(); |
| 269 } |
| 270 |
| 271 void WebTestDelegateImpl::FetchManifest( |
| 272 blink::WebView* view, |
| 273 const GURL& url, |
| 274 const base::Callback<void(const blink::WebURLResponse& response, |
| 275 const std::string& data)>& callback) { |
| 276 NOTIMPLEMENTED(); |
| 277 } |
| 278 |
| 279 void WebTestDelegateImpl::SetPermission(const std::string& permission_name, |
| 280 const std::string& permission_value, |
| 281 const GURL& origin, |
| 282 const GURL& embedding_origin) { |
| 283 NOTIMPLEMENTED(); |
| 284 } |
| 285 |
| 286 void WebTestDelegateImpl::ResetPermissions() { |
| 287 NOTIMPLEMENTED(); |
| 288 } |
| 289 |
| 290 scoped_refptr<cc::TextureLayer> |
| 291 WebTestDelegateImpl::CreateTextureLayerForMailbox( |
| 292 cc::TextureLayerClient* client) { |
| 293 NOTIMPLEMENTED(); |
| 294 return nullptr; |
| 295 } |
| 296 |
| 297 blink::WebLayer* WebTestDelegateImpl::InstantiateWebLayer( |
| 298 scoped_refptr<cc::TextureLayer> layer) { |
| 299 NOTIMPLEMENTED(); |
| 300 return nullptr; |
| 301 } |
| 302 |
| 303 cc::SharedBitmapManager* WebTestDelegateImpl::GetSharedBitmapManager() { |
| 304 NOTIMPLEMENTED(); |
| 305 return nullptr; |
| 306 } |
| 307 |
| 308 void WebTestDelegateImpl::DispatchBeforeInstallPromptEvent( |
| 309 int request_id, |
| 310 const std::vector<std::string>& event_platforms, |
| 311 const base::Callback<void(bool)>& callback) { |
| 312 NOTIMPLEMENTED(); |
| 313 } |
| 314 |
| 315 void WebTestDelegateImpl::ResolveBeforeInstallPromptPromise(int request_id, |
| 316 const std::string& platform) { |
| 317 NOTIMPLEMENTED(); |
| 318 } |
| 319 |
| 320 blink::WebPlugin* WebTestDelegateImpl::CreatePluginPlaceholder( |
| 321 blink::WebLocalFrame* frame, |
| 322 const blink::WebPluginParams& params) { |
| 323 NOTIMPLEMENTED(); |
| 324 return nullptr; |
| 325 } |
| 326 |
| 327 } // namespace html_viewer |
OLD | NEW |