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

Side by Side Diff: content/renderer/media/mock_media_stream_video_source.h

Issue 366243003: VideoTrackAdapter: Add passing frames monitor, notify MSVCS -> MSVTrack(s) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: grunell@ comments and added a UT with 1 source muted pinging two tracks. Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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 CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 6 #define CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
7 7
8 #include "content/renderer/media/media_stream_video_source.h" 8 #include "content/renderer/media/media_stream_video_source.h"
9 9
10 #include "testing/gmock/include/gmock/gmock.h"
11
10 namespace content { 12 namespace content {
11 13
12 class MockMediaStreamVideoSource : public MediaStreamVideoSource { 14 class MockMediaStreamVideoSource : public MediaStreamVideoSource {
13 public: 15 public:
14 explicit MockMediaStreamVideoSource(bool manual_get_supported_formats); 16 explicit MockMediaStreamVideoSource(bool manual_get_supported_formats);
15 virtual ~MockMediaStreamVideoSource(); 17 virtual ~MockMediaStreamVideoSource();
16 18
19 MOCK_METHOD1(DoSetMutedState, void(bool muted_state));
20
17 // Simulate that the underlying source start successfully. 21 // Simulate that the underlying source start successfully.
18 void StartMockedSource(); 22 void StartMockedSource();
19 23
20 // Simulate that the underlying source fail to start. 24 // Simulate that the underlying source fail to start.
21 void FailToStartMockedSource(); 25 void FailToStartMockedSource();
22 26
23 // Returns true if StartSource has been called and StartMockedSource 27 // Returns true if StartSource has been called and StartMockedSource
24 // or FailToStartMockedSource has not been called. 28 // or FailToStartMockedSource has not been called.
25 bool SourceHasAttemptedToStart() { return attempted_to_start_; } 29 bool SourceHasAttemptedToStart() { return attempted_to_start_; }
26 30
27 void SetSupportedFormats(const media::VideoCaptureFormats& formats) { 31 void SetSupportedFormats(const media::VideoCaptureFormats& formats) {
28 supported_formats_ = formats; 32 supported_formats_ = formats;
29 } 33 }
30 34
31 // Delivers |frame| to all registered tracks on the IO thread. Its up to the 35 // Delivers |frame| to all registered tracks on the IO thread. Its up to the
32 // call to make sure MockMediaStreamVideoSource is not destroyed before the 36 // call to make sure MockMediaStreamVideoSource is not destroyed before the
33 // frame has been delivered. 37 // frame has been delivered.
34 void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame); 38 void DeliverVideoFrame(const scoped_refptr<media::VideoFrame>& frame);
35 39
36 void CompleteGetSupportedFormats(); 40 void CompleteGetSupportedFormats();
37 41
38 const media::VideoCaptureParams& start_params() const { return params_; } 42 const media::VideoCaptureParams& start_params() const { return params_; }
39 int max_requested_height() const { return max_requested_height_; } 43 int max_requested_height() const { return max_requested_height_; }
40 int max_requested_width() const { return max_requested_width_; } 44 int max_requested_width() const { return max_requested_width_; }
41 45
46 void SetMutedState(bool muted_state) {
47 MediaStreamVideoSource::SetMutedState(muted_state);
48 DoSetMutedState(muted_state);
49 }
50
42 protected: 51 protected:
43 void DeliverVideoFrameOnIO(const scoped_refptr<media::VideoFrame>& frame, 52 void DeliverVideoFrameOnIO(const scoped_refptr<media::VideoFrame>& frame,
44 media::VideoCaptureFormat format, 53 media::VideoCaptureFormat format,
45 const base::TimeTicks& estimated_capture_time, 54 const base::TimeTicks& estimated_capture_time,
46 const VideoCaptureDeliverFrameCB& frame_callback); 55 const VideoCaptureDeliverFrameCB& frame_callback);
47 56
48 // Implements MediaStreamVideoSource. 57 // Implements MediaStreamVideoSource.
49 virtual void GetCurrentSupportedFormats( 58 virtual void GetCurrentSupportedFormats(
50 int max_requested_height, 59 int max_requested_height,
51 int max_requested_width, 60 int max_requested_width,
(...skipping 12 matching lines...) Expand all
64 bool attempted_to_start_; 73 bool attempted_to_start_;
65 VideoCaptureDeviceFormatsCB formats_callback_; 74 VideoCaptureDeviceFormatsCB formats_callback_;
66 VideoCaptureDeliverFrameCB frame_callback_; 75 VideoCaptureDeliverFrameCB frame_callback_;
67 76
68 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource); 77 DISALLOW_COPY_AND_ASSIGN(MockMediaStreamVideoSource);
69 }; 78 };
70 79
71 } // namespace content 80 } // namespace content
72 81
73 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_ 82 #endif // CONTENT_RENDERER_MEDIA_MOCK_MEDIA_STREAM_VIDEO_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698