| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 // VS warns when we inherit the WebWidgetClient method implementations from | 299 // VS warns when we inherit the WebWidgetClient method implementations from |
| 300 // RenderWidget. It's safe to ignore that warning. | 300 // RenderWidget. It's safe to ignore that warning. |
| 301 #pragma warning(disable: 4250) | 301 #pragma warning(disable: 4250) |
| 302 #endif | 302 #endif |
| 303 template <class Base, typename... Args> | 303 template <class Base, typename... Args> |
| 304 class WebTestProxy : public Base, public WebTestProxyBase { | 304 class WebTestProxy : public Base, public WebTestProxyBase { |
| 305 public: | 305 public: |
| 306 explicit WebTestProxy(Args... args) : Base(args...) {} | 306 explicit WebTestProxy(Args... args) : Base(args...) {} |
| 307 | 307 |
| 308 // WebWidgetClient implementation. | 308 // WebWidgetClient implementation. |
| 309 virtual blink::WebScreenInfo screenInfo() { | 309 blink::WebScreenInfo screenInfo() override { |
| 310 blink::WebScreenInfo info = Base::screenInfo(); | 310 blink::WebScreenInfo info = Base::screenInfo(); |
| 311 WebTestProxyBase::GetScreenOrientationForTesting(info); | 311 WebTestProxyBase::GetScreenOrientationForTesting(info); |
| 312 return info; | 312 return info; |
| 313 } | 313 } |
| 314 | 314 |
| 315 // WebViewClient implementation. | 315 // WebViewClient implementation. |
| 316 virtual void scheduleAnimation() { WebTestProxyBase::ScheduleAnimation(); } | 316 void scheduleAnimation() override { WebTestProxyBase::ScheduleAnimation(); } |
| 317 virtual void startDragging(blink::WebLocalFrame* frame, | 317 void startDragging(blink::WebLocalFrame* frame, |
| 318 const blink::WebDragData& data, | 318 const blink::WebDragData& data, |
| 319 blink::WebDragOperationsMask mask, | 319 blink::WebDragOperationsMask mask, |
| 320 const blink::WebImage& image, | 320 const blink::WebImage& image, |
| 321 const blink::WebPoint& point) { | 321 const blink::WebPoint& point) override { |
| 322 WebTestProxyBase::StartDragging(frame, data, mask, image, point); | 322 WebTestProxyBase::StartDragging(frame, data, mask, image, point); |
| 323 // Don't forward this call to Base because we don't want to do a real | 323 // Don't forward this call to Base because we don't want to do a real |
| 324 // drag-and-drop. | 324 // drag-and-drop. |
| 325 } | 325 } |
| 326 virtual void didChangeContents() { | 326 void didChangeContents() override { |
| 327 WebTestProxyBase::DidChangeContents(); | 327 WebTestProxyBase::DidChangeContents(); |
| 328 Base::didChangeContents(); | 328 Base::didChangeContents(); |
| 329 } | 329 } |
| 330 virtual blink::WebView* createView(blink::WebLocalFrame* creator, | 330 blink::WebView* createView(blink::WebLocalFrame* creator, |
| 331 const blink::WebURLRequest& request, | 331 const blink::WebURLRequest& request, |
| 332 const blink::WebWindowFeatures& features, | 332 const blink::WebWindowFeatures& features, |
| 333 const blink::WebString& frame_name, | 333 const blink::WebString& frame_name, |
| 334 blink::WebNavigationPolicy policy, | 334 blink::WebNavigationPolicy policy, |
| 335 bool suppress_opener) { | 335 bool suppress_opener) override { |
| 336 if (!WebTestProxyBase::CreateView( | 336 if (!WebTestProxyBase::CreateView( |
| 337 creator, request, features, frame_name, policy, suppress_opener)) | 337 creator, request, features, frame_name, policy, suppress_opener)) |
| 338 return 0; | 338 return 0; |
| 339 return Base::createView( | 339 return Base::createView( |
| 340 creator, request, features, frame_name, policy, suppress_opener); | 340 creator, request, features, frame_name, policy, suppress_opener); |
| 341 } | 341 } |
| 342 virtual void setStatusText(const blink::WebString& text) { | 342 void setStatusText(const blink::WebString& text) override { |
| 343 WebTestProxyBase::SetStatusText(text); | 343 WebTestProxyBase::SetStatusText(text); |
| 344 Base::setStatusText(text); | 344 Base::setStatusText(text); |
| 345 } | 345 } |
| 346 virtual void printPage(blink::WebLocalFrame* frame) { | 346 void printPage(blink::WebLocalFrame* frame) override { |
| 347 WebTestProxyBase::PrintPage(frame); | 347 WebTestProxyBase::PrintPage(frame); |
| 348 } | 348 } |
| 349 virtual blink::WebSpeechRecognizer* speechRecognizer() { | 349 blink::WebSpeechRecognizer* speechRecognizer() override { |
| 350 return WebTestProxyBase::GetSpeechRecognizer(); | 350 return WebTestProxyBase::GetSpeechRecognizer(); |
| 351 } | 351 } |
| 352 virtual bool requestPointerLock() { | 352 bool requestPointerLock() override { |
| 353 return WebTestProxyBase::RequestPointerLock(); | 353 return WebTestProxyBase::RequestPointerLock(); |
| 354 } | 354 } |
| 355 virtual void requestPointerUnlock() { | 355 void requestPointerUnlock() override { |
| 356 WebTestProxyBase::RequestPointerUnlock(); | 356 WebTestProxyBase::RequestPointerUnlock(); |
| 357 } | 357 } |
| 358 virtual bool isPointerLocked() { return WebTestProxyBase::IsPointerLocked(); } | 358 bool isPointerLocked() override { |
| 359 virtual void didFocus() { | 359 return WebTestProxyBase::IsPointerLocked(); |
| 360 } |
| 361 void didFocus() override { |
| 360 WebTestProxyBase::DidFocus(); | 362 WebTestProxyBase::DidFocus(); |
| 361 Base::didFocus(); | 363 Base::didFocus(); |
| 362 } | 364 } |
| 363 virtual void setToolTipText(const blink::WebString& text, | 365 void setToolTipText(const blink::WebString& text, |
| 364 blink::WebTextDirection hint) { | 366 blink::WebTextDirection hint) override { |
| 365 WebTestProxyBase::SetToolTipText(text, hint); | 367 WebTestProxyBase::SetToolTipText(text, hint); |
| 366 Base::setToolTipText(text, hint); | 368 Base::setToolTipText(text, hint); |
| 367 } | 369 } |
| 368 virtual void resetInputMethod() { WebTestProxyBase::ResetInputMethod(); } | 370 void resetInputMethod() override { WebTestProxyBase::ResetInputMethod(); } |
| 369 virtual bool runFileChooser(const blink::WebFileChooserParams& params, | 371 bool runFileChooser(const blink::WebFileChooserParams& params, |
| 370 blink::WebFileChooserCompletion* completion) { | 372 blink::WebFileChooserCompletion* completion) override { |
| 371 return WebTestProxyBase::RunFileChooser(params, completion); | 373 return WebTestProxyBase::RunFileChooser(params, completion); |
| 372 } | 374 } |
| 373 virtual void showValidationMessage(const blink::WebRect& anchor_in_root_view, | 375 void showValidationMessage( |
| 374 const blink::WebString& main_message, | 376 const blink::WebRect& anchor_in_root_view, |
| 375 blink::WebTextDirection main_message_hint, | 377 const blink::WebString& main_message, |
| 376 const blink::WebString& sub_message, | 378 blink::WebTextDirection main_message_hint, |
| 377 blink::WebTextDirection sub_message_hint) { | 379 const blink::WebString& sub_message, |
| 380 blink::WebTextDirection sub_message_hint) override { |
| 378 WebTestProxyBase::ShowValidationMessage(main_message, main_message_hint, | 381 WebTestProxyBase::ShowValidationMessage(main_message, main_message_hint, |
| 379 sub_message, sub_message_hint); | 382 sub_message, sub_message_hint); |
| 380 } | 383 } |
| 381 virtual blink::WebString acceptLanguages() { | 384 blink::WebString acceptLanguages() override { |
| 382 return WebTestProxyBase::acceptLanguages(); | 385 return WebTestProxyBase::acceptLanguages(); |
| 383 } | 386 } |
| 384 | 387 |
| 385 private: | 388 private: |
| 386 virtual ~WebTestProxy() {} | 389 virtual ~WebTestProxy() {} |
| 387 | 390 |
| 388 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); | 391 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); |
| 389 }; | 392 }; |
| 390 | 393 |
| 391 } // namespace test_runner | 394 } // namespace test_runner |
| 392 | 395 |
| 393 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ | 396 #endif // COMPONENTS_TEST_RUNNER_WEB_TEST_PROXY_H_ |
| OLD | NEW |