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

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

Issue 1448203002: Add layout tests for the audio component of MediaStream Recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 1 month 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
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 <algorithm> 7 #include <algorithm>
8 #include <clocale> 8 #include <clocale>
9 #include <cmath> 9 #include <cmath>
10 10
(...skipping 29 matching lines...) Expand all
40 #include "content/public/renderer/render_view.h" 40 #include "content/public/renderer/render_view.h"
41 #include "content/public/renderer/render_view_visitor.h" 41 #include "content/public/renderer/render_view_visitor.h"
42 #include "content/public/renderer/renderer_gamepad_provider.h" 42 #include "content/public/renderer/renderer_gamepad_provider.h"
43 #include "content/public/test/layouttest_support.h" 43 #include "content/public/test/layouttest_support.h"
44 #include "content/shell/common/layout_test/layout_test_messages.h" 44 #include "content/shell/common/layout_test/layout_test_messages.h"
45 #include "content/shell/common/shell_messages.h" 45 #include "content/shell/common/shell_messages.h"
46 #include "content/shell/common/shell_switches.h" 46 #include "content/shell/common/shell_switches.h"
47 #include "content/shell/renderer/layout_test/blink_test_helpers.h" 47 #include "content/shell/renderer/layout_test/blink_test_helpers.h"
48 #include "content/shell/renderer/layout_test/layout_test_render_process_observer .h" 48 #include "content/shell/renderer/layout_test/layout_test_render_process_observer .h"
49 #include "content/shell/renderer/layout_test/leak_detector.h" 49 #include "content/shell/renderer/layout_test/leak_detector.h"
50 #include "media/audio/audio_parameters.h"
50 #include "net/base/filename_util.h" 51 #include "net/base/filename_util.h"
51 #include "net/base/net_errors.h" 52 #include "net/base/net_errors.h"
52 #include "skia/ext/platform_canvas.h" 53 #include "skia/ext/platform_canvas.h"
53 #include "third_party/WebKit/public/platform/Platform.h" 54 #include "third_party/WebKit/public/platform/Platform.h"
54 #include "third_party/WebKit/public/platform/WebCString.h" 55 #include "third_party/WebKit/public/platform/WebCString.h"
55 #include "third_party/WebKit/public/platform/WebPoint.h" 56 #include "third_party/WebKit/public/platform/WebPoint.h"
56 #include "third_party/WebKit/public/platform/WebRect.h" 57 #include "third_party/WebKit/public/platform/WebRect.h"
57 #include "third_party/WebKit/public/platform/WebSize.h" 58 #include "third_party/WebKit/public/platform/WebSize.h"
58 #include "third_party/WebKit/public/platform/WebString.h" 59 #include "third_party/WebKit/public/platform/WebString.h"
59 #include "third_party/WebKit/public/platform/WebTaskRunner.h" 60 #include "third_party/WebKit/public/platform/WebTaskRunner.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 int max_requested_height, 233 int max_requested_height,
233 double max_requested_frame_rate, 234 double max_requested_frame_rate,
234 const VideoCaptureDeviceFormatsCB& callback) override {} 235 const VideoCaptureDeviceFormatsCB& callback) override {}
235 void StartCapture( 236 void StartCapture(
236 const media::VideoCaptureParams& params, 237 const media::VideoCaptureParams& params,
237 const VideoCaptureDeliverFrameCB& new_frame_callback, 238 const VideoCaptureDeliverFrameCB& new_frame_callback,
238 const RunningCallback& running_callback) override {} 239 const RunningCallback& running_callback) override {}
239 void StopCapture() override {} 240 void StopCapture() override {}
240 }; 241 };
241 242
243 class MockAudioCapturerSource : public media::AudioCapturerSource {
244 public:
245 MockAudioCapturerSource() = default;
246
247 void Initialize(const media::AudioParameters& params,
248 CaptureCallback* callback,
249 int session_id) override {}
250 void Start() override {}
251 void Stop() override {}
252 void SetVolume(double volume) override {}
253 void SetAutomaticGainControl(bool enable) override {}
254
255 protected:
256 ~MockAudioCapturerSource() override {}
257 };
258
242 } // namespace 259 } // namespace
243 260
244 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) 261 BlinkTestRunner::BlinkTestRunner(RenderView* render_view)
245 : RenderViewObserver(render_view), 262 : RenderViewObserver(render_view),
246 RenderViewObserverTracker<BlinkTestRunner>(render_view), 263 RenderViewObserverTracker<BlinkTestRunner>(render_view),
247 proxy_(NULL), 264 proxy_(NULL),
248 focused_view_(NULL), 265 focused_view_(NULL),
249 is_main_window_(false), 266 is_main_window_(false),
250 focus_on_next_commit_(false), 267 focus_on_next_commit_(false),
251 leak_detector_(new LeakDetector(this)) { 268 leak_detector_(new LeakDetector(this)) {
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 plugins::PluginPlaceholder* placeholder = 753 plugins::PluginPlaceholder* placeholder =
737 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame, 754 new plugins::PluginPlaceholder(render_view()->GetMainRenderFrame(), frame,
738 params, "<div>Test content</div>"); 755 params, "<div>Test content</div>");
739 return placeholder->plugin(); 756 return placeholder->plugin();
740 } 757 }
741 758
742 void BlinkTestRunner::OnWebTestProxyBaseDestroy( 759 void BlinkTestRunner::OnWebTestProxyBaseDestroy(
743 test_runner::WebTestProxyBase* proxy) { 760 test_runner::WebTestProxyBase* proxy) {
744 } 761 }
745 762
746 bool BlinkTestRunner::AddMediaStreamSourceAndTrack( 763 bool BlinkTestRunner::AddMediaStreamVideoSourceAndTrack(
747 blink::WebMediaStream* stream) { 764 blink::WebMediaStream* stream) {
748 DCHECK(stream); 765 DCHECK(stream);
749 #if defined(ENABLE_WEBRTC) 766 #if defined(ENABLE_WEBRTC)
750 return AddVideoTrackToMediaStream( 767 return AddVideoTrackToMediaStream(
751 make_scoped_ptr(new MockVideoCapturerSource()), 768 make_scoped_ptr(new MockVideoCapturerSource()),
752 false /* is_remote */, 769 false /* is_remote */, false /* is_readonly */, stream);
753 false /* is_readonly */,
754 stream);
755 #else 770 #else
756 return false; 771 return false;
757 #endif 772 #endif
773 }
774
775 bool BlinkTestRunner::AddMediaStreamAudioSourceAndTrack(
776 blink::WebMediaStream* stream) {
777 DCHECK(stream);
778 #if defined(ENABLE_WEBRTC)
779 return AddAudioTrackToMediaStream(
780 make_scoped_refptr(new MockAudioCapturerSource()),
781 false /* is_remote */, false /* is_readonly */, stream);
782 #else
783 return false;
784 #endif
758 } 785 }
759 786
760 // RenderViewObserver -------------------------------------------------------- 787 // RenderViewObserver --------------------------------------------------------
761 788
762 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) { 789 void BlinkTestRunner::DidClearWindowObject(WebLocalFrame* frame) {
763 WebTestingSupport::injectInternalsObject(frame); 790 WebTestingSupport::injectInternalsObject(frame);
764 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo( 791 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces()->BindTo(
765 frame); 792 frame);
766 } 793 }
767 794
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 get_bluetooth_events_callbacks_.pop_front(); 990 get_bluetooth_events_callbacks_.pop_front();
964 callback.Run(events); 991 callback.Run(events);
965 } 992 }
966 993
967 void BlinkTestRunner::ReportLeakDetectionResult( 994 void BlinkTestRunner::ReportLeakDetectionResult(
968 const LeakDetectionResult& report) { 995 const LeakDetectionResult& report) {
969 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 996 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
970 } 997 }
971 998
972 } // namespace content 999 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698