Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 1835673002: Moving pixel-capturing code from web_test_proxy_base.* into pixel_dump.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replicating-accept-languages
Patch Set: Rebasing... Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/layout_test/blink_test_runner.h" 5 #include "content/shell/renderer/layout_test/blink_test_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <clocale> 9 #include <clocale>
10 #include <cmath> 10 #include <cmath>
(...skipping 12 matching lines...) Expand all
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
25 #include "base/strings/sys_string_conversions.h" 25 #include "base/strings/sys_string_conversions.h"
26 #include "base/strings/utf_string_conversions.h" 26 #include "base/strings/utf_string_conversions.h"
27 #include "base/thread_task_runner_handle.h" 27 #include "base/thread_task_runner_handle.h"
28 #include "base/time/time.h" 28 #include "base/time/time.h"
29 #include "base/values.h" 29 #include "base/values.h"
30 #include "build/build_config.h" 30 #include "build/build_config.h"
31 #include "components/plugins/renderer/plugin_placeholder.h" 31 #include "components/plugins/renderer/plugin_placeholder.h"
32 #include "components/test_runner/gamepad_controller.h" 32 #include "components/test_runner/gamepad_controller.h"
33 #include "components/test_runner/pixel_dump.h"
33 #include "components/test_runner/web_test_interfaces.h" 34 #include "components/test_runner/web_test_interfaces.h"
34 #include "components/test_runner/web_test_proxy.h" 35 #include "components/test_runner/web_test_proxy.h"
35 #include "components/test_runner/web_test_runner.h" 36 #include "components/test_runner/web_test_runner.h"
36 #include "content/public/common/content_switches.h" 37 #include "content/public/common/content_switches.h"
37 #include "content/public/common/url_constants.h" 38 #include "content/public/common/url_constants.h"
38 #include "content/public/common/web_preferences.h" 39 #include "content/public/common/web_preferences.h"
39 #include "content/public/renderer/media_stream_utils.h" 40 #include "content/public/renderer/media_stream_utils.h"
40 #include "content/public/renderer/render_frame.h" 41 #include "content/public/renderer/render_frame.h"
41 #include "content/public/renderer/render_view.h" 42 #include "content/public/renderer/render_view.h"
42 #include "content/public/renderer/render_view_visitor.h" 43 #include "content/public/renderer/render_view_visitor.h"
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) { 723 blink::WebLocalFrame* frame, const blink::WebPluginParams& params) {
723 if (params.mimeType != "application/x-plugin-placeholder-test") 724 if (params.mimeType != "application/x-plugin-placeholder-test")
724 return nullptr; 725 return nullptr;
725 726
726 plugins::PluginPlaceholder* placeholder = 727 plugins::PluginPlaceholder* placeholder =
727 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, 728 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame,
728 params, "<div>Test content</div>"); 729 params, "<div>Test content</div>");
729 return placeholder->plugin(); 730 return placeholder->plugin();
730 } 731 }
731 732
732 blink::WebPoint BlinkTestRunner::ConvertDIPToNative( 733 float BlinkTestRunner::GetDeviceScaleFactorForTest() const {
733 const blink::WebPoint& point_in_dip) const { 734 return render_view()->GetDeviceScaleFactorForTest();
734 float scale = render_view()->GetDeviceScaleFactorForTest();
735 return blink::WebPoint(point_in_dip.x * scale,
736 point_in_dip.y * scale);
737 } 735 }
738 736
739 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack( 737 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack(
740 blink::WebMediaStream* stream) { 738 blink::WebMediaStream* stream) {
741 DCHECK(stream); 739 DCHECK(stream);
742 #if defined(ENABLE_WEBRTC) 740 #if defined(ENABLE_WEBRTC)
743 return AddVideoTrackToMediaStream( 741 return AddVideoTrackToMediaStream(
744 make_scoped_ptr(new MockVideoCapturerSource()), 742 make_scoped_ptr(new MockVideoCapturerSource()),
745 false, // is_remote 743 false, // is_remote
746 false, // is_readonly 744 false, // is_readonly
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 CaptureDumpContinued(); 887 CaptureDumpContinued();
890 } 888 }
891 889
892 void BlinkTestRunner::CaptureDumpContinued() { 890 void BlinkTestRunner::CaptureDumpContinued() {
893 test_runner::WebTestInterfaces* interfaces = 891 test_runner::WebTestInterfaces* interfaces =
894 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); 892 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces();
895 if (test_config_.enable_pixel_dumping && 893 if (test_config_.enable_pixel_dumping &&
896 interfaces->TestRunner()->ShouldGeneratePixelResults() && 894 interfaces->TestRunner()->ShouldGeneratePixelResults() &&
897 !interfaces->TestRunner()->ShouldDumpAsAudio()) { 895 !interfaces->TestRunner()->ShouldDumpAsAudio()) {
898 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); 896 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive());
899 proxy()->CapturePixelsAsync(base::Bind( 897 interfaces->TestRunner()->DumpPixelsAsync(
900 &BlinkTestRunner::OnPixelsDumpCompleted, base::Unretained(this))); 898 render_view()->GetWebView(),
899 base::Bind(&BlinkTestRunner::OnPixelsDumpCompleted,
900 base::Unretained(this)));
901 return; 901 return;
902 } 902 }
903 903
904 #ifndef NDEBUG 904 #ifndef NDEBUG
905 // Force a layout/paint by the end of the test to ensure test coverage of 905 // Force a layout/paint by the end of the test to ensure test coverage of
906 // incremental painting. 906 // incremental painting.
907 proxy()->LayoutAndPaintAsyncThen(base::Bind( 907 proxy()->LayoutAndPaintAsyncThen(base::Bind(
908 &BlinkTestRunner::CaptureDumpComplete, base::Unretained(this))); 908 &BlinkTestRunner::CaptureDumpComplete, base::Unretained(this)));
909 #else 909 #else
910 CaptureDumpComplete(); 910 CaptureDumpComplete();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 get_bluetooth_events_callbacks_.pop_front(); 1009 get_bluetooth_events_callbacks_.pop_front();
1010 callback.Run(events); 1010 callback.Run(events);
1011 } 1011 }
1012 1012
1013 void BlinkTestRunner::ReportLeakDetectionResult( 1013 void BlinkTestRunner::ReportLeakDetectionResult(
1014 const LeakDetectionResult& report) { 1014 const LeakDetectionResult& report) {
1015 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1015 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1016 } 1016 }
1017 1017
1018 } // namespace content 1018 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698