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

Side by Side Diff: content/renderer/media/media_stream_dispatcher_unittest.cc

Issue 670683003: Standardize usage of virtual/override/final in content/renderer/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 <string> 5 #include <string>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 19 matching lines...) Expand all
30 const MediaStreamType kAudioType = MEDIA_DEVICE_AUDIO_CAPTURE; 30 const MediaStreamType kAudioType = MEDIA_DEVICE_AUDIO_CAPTURE;
31 const MediaStreamType kVideoType = MEDIA_DEVICE_VIDEO_CAPTURE; 31 const MediaStreamType kVideoType = MEDIA_DEVICE_VIDEO_CAPTURE;
32 32
33 class MockMediaStreamDispatcherEventHandler 33 class MockMediaStreamDispatcherEventHandler
34 : public MediaStreamDispatcherEventHandler, 34 : public MediaStreamDispatcherEventHandler,
35 public base::SupportsWeakPtr<MockMediaStreamDispatcherEventHandler> { 35 public base::SupportsWeakPtr<MockMediaStreamDispatcherEventHandler> {
36 public: 36 public:
37 MockMediaStreamDispatcherEventHandler() 37 MockMediaStreamDispatcherEventHandler()
38 : request_id_(-1) {} 38 : request_id_(-1) {}
39 39
40 virtual void OnStreamGenerated( 40 void OnStreamGenerated(
41 int request_id, 41 int request_id,
42 const std::string &label, 42 const std::string& label,
43 const StreamDeviceInfoArray& audio_device_array, 43 const StreamDeviceInfoArray& audio_device_array,
44 const StreamDeviceInfoArray& video_device_array) override { 44 const StreamDeviceInfoArray& video_device_array) override {
45 request_id_ = request_id; 45 request_id_ = request_id;
46 label_ = label; 46 label_ = label;
47 if (audio_device_array.size()) { 47 if (audio_device_array.size()) {
48 DCHECK(audio_device_array.size() == 1); 48 DCHECK(audio_device_array.size() == 1);
49 audio_device_ = audio_device_array[0]; 49 audio_device_ = audio_device_array[0];
50 } 50 }
51 if (video_device_array.size()) { 51 if (video_device_array.size()) {
52 DCHECK(video_device_array.size() == 1); 52 DCHECK(video_device_array.size() == 1);
53 video_device_ = video_device_array[0]; 53 video_device_ = video_device_array[0];
54 } 54 }
55 } 55 }
56 56
57 virtual void OnStreamGenerationFailed( 57 void OnStreamGenerationFailed(
58 int request_id, 58 int request_id,
59 content::MediaStreamRequestResult result) override { 59 content::MediaStreamRequestResult result) override {
60 request_id_ = request_id; 60 request_id_ = request_id;
61 } 61 }
62 62
63 virtual void OnDeviceStopped(const std::string& label, 63 void OnDeviceStopped(const std::string& label,
64 const StreamDeviceInfo& device_info) override { 64 const StreamDeviceInfo& device_info) override {
65 device_stopped_label_ = label; 65 device_stopped_label_ = label;
66 if (IsVideoMediaType(device_info.device.type)) { 66 if (IsVideoMediaType(device_info.device.type)) {
67 EXPECT_TRUE(StreamDeviceInfo::IsEqual(video_device_, device_info)); 67 EXPECT_TRUE(StreamDeviceInfo::IsEqual(video_device_, device_info));
68 } 68 }
69 if (IsAudioInputMediaType(device_info.device.type)) { 69 if (IsAudioInputMediaType(device_info.device.type)) {
70 EXPECT_TRUE(StreamDeviceInfo::IsEqual(audio_device_, device_info)); 70 EXPECT_TRUE(StreamDeviceInfo::IsEqual(audio_device_, device_info));
71 } 71 }
72 } 72 }
73 73
74 virtual void OnDevicesEnumerated( 74 void OnDevicesEnumerated(int request_id,
75 int request_id, 75 const StreamDeviceInfoArray& device_array) override {
76 const StreamDeviceInfoArray& device_array) override {
77 request_id_ = request_id; 76 request_id_ = request_id;
78 } 77 }
79 78
80 virtual void OnDeviceOpened( 79 void OnDeviceOpened(int request_id,
81 int request_id, 80 const std::string& label,
82 const std::string& label, 81 const StreamDeviceInfo& video_device) override {
83 const StreamDeviceInfo& video_device) override {
84 request_id_ = request_id; 82 request_id_ = request_id;
85 label_ = label; 83 label_ = label;
86 } 84 }
87 85
88 virtual void OnDeviceOpenFailed(int request_id) override { 86 void OnDeviceOpenFailed(int request_id) override { request_id_ = request_id; }
89 request_id_ = request_id;
90 }
91 87
92 void ResetStoredParameters() { 88 void ResetStoredParameters() {
93 request_id_ = -1; 89 request_id_ = -1;
94 label_ = ""; 90 label_ = "";
95 device_stopped_label_ = ""; 91 device_stopped_label_ = "";
96 audio_device_ = StreamDeviceInfo(); 92 audio_device_ = StreamDeviceInfo();
97 video_device_ = StreamDeviceInfo(); 93 video_device_ = StreamDeviceInfo();
98 } 94 }
99 95
100 int request_id_; 96 int request_id_;
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // Ducking should still be reported as not active. 461 // Ducking should still be reported as not active.
466 EXPECT_FALSE(dispatcher->IsAudioDuckingActive()); 462 EXPECT_FALSE(dispatcher->IsAudioDuckingActive());
467 463
468 // Stop the device (removes the stream). 464 // Stop the device (removes the stream).
469 dispatcher->OnMessageReceived( 465 dispatcher->OnMessageReceived(
470 MediaStreamMsg_DeviceStopped(kRouteId, kStreamLabel, 466 MediaStreamMsg_DeviceStopped(kRouteId, kStreamLabel,
471 handler->audio_device_)); 467 handler->audio_device_));
472 } 468 }
473 469
474 } // namespace content 470 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_dispatcher.h ('k') | content/renderer/media/media_stream_video_capturer_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698