| 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 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 | 677 |
| 678 LayoutAndPaintCallback* layout_and_paint_callback = | 678 LayoutAndPaintCallback* layout_and_paint_callback = |
| 679 new LayoutAndPaintCallback(callback); | 679 new LayoutAndPaintCallback(callback); |
| 680 web_widget_->layoutAndPaintAsync(layout_and_paint_callback); | 680 web_widget_->layoutAndPaintAsync(layout_and_paint_callback); |
| 681 if (blink::WebPagePopup* popup = web_widget_->pagePopup()) { | 681 if (blink::WebPagePopup* popup = web_widget_->pagePopup()) { |
| 682 layout_and_paint_callback->set_wait_for_popup(true); | 682 layout_and_paint_callback->set_wait_for_popup(true); |
| 683 popup->layoutAndPaintAsync(layout_and_paint_callback); | 683 popup->layoutAndPaintAsync(layout_and_paint_callback); |
| 684 } | 684 } |
| 685 } | 685 } |
| 686 | 686 |
| 687 void WebTestProxyBase::DidDisplayAsync(const base::Closure& callback, | |
| 688 const SkBitmap& bitmap) { | |
| 689 // Verify we actually composited. | |
| 690 CHECK_NE(0, bitmap.info().fWidth); | |
| 691 CHECK_NE(0, bitmap.info().fHeight); | |
| 692 if (!callback.is_null()) | |
| 693 callback.Run(); | |
| 694 } | |
| 695 | |
| 696 void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) { | |
| 697 TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen"); | |
| 698 CapturePixelsAsync(base::Bind( | |
| 699 &WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback)); | |
| 700 } | |
| 701 | |
| 702 void WebTestProxyBase::GetScreenOrientationForTesting( | 687 void WebTestProxyBase::GetScreenOrientationForTesting( |
| 703 blink::WebScreenInfo& screen_info) { | 688 blink::WebScreenInfo& screen_info) { |
| 704 if (!screen_orientation_client_) | 689 if (!screen_orientation_client_) |
| 705 return; | 690 return; |
| 706 // Override screen orientation information with mock data. | 691 // Override screen orientation information with mock data. |
| 707 screen_info.orientationType = | 692 screen_info.orientationType = |
| 708 screen_orientation_client_->CurrentOrientationType(); | 693 screen_orientation_client_->CurrentOrientationType(); |
| 709 screen_info.orientationAngle = | 694 screen_info.orientationAngle = |
| 710 screen_orientation_client_->CurrentOrientationAngle(); | 695 screen_orientation_client_->CurrentOrientationAngle(); |
| 711 } | 696 } |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 // to cancel the input method's ongoing composition session. | 1394 // to cancel the input method's ongoing composition session. |
| 1410 if (web_widget_) | 1395 if (web_widget_) |
| 1411 web_widget_->confirmComposition(); | 1396 web_widget_->confirmComposition(); |
| 1412 } | 1397 } |
| 1413 | 1398 |
| 1414 blink::WebString WebTestProxyBase::acceptLanguages() { | 1399 blink::WebString WebTestProxyBase::acceptLanguages() { |
| 1415 return blink::WebString::fromUTF8(accept_languages_); | 1400 return blink::WebString::fromUTF8(accept_languages_); |
| 1416 } | 1401 } |
| 1417 | 1402 |
| 1418 } // namespace content | 1403 } // namespace content |
| OLD | NEW |