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

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

Issue 2813543005: Revert of Initialize default audio device ID with explicit device ID. (Closed)
Patch Set: Created 3 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/renderer/media/user_media_client_impl.cc ('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/renderer/media/user_media_client_impl.h" 5 #include "content/renderer/media/user_media_client_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "content/child/child_process.h" 16 #include "content/child/child_process.h"
17 #include "content/common/media/media_devices.h" 17 #include "content/common/media/media_devices.h"
18 #include "content/renderer/media/media_stream.h" 18 #include "content/renderer/media/media_stream.h"
19 #include "content/renderer/media/media_stream_audio_source.h" 19 #include "content/renderer/media/media_stream_audio_source.h"
20 #include "content/renderer/media/media_stream_track.h" 20 #include "content/renderer/media/media_stream_track.h"
21 #include "content/renderer/media/mock_constraint_factory.h" 21 #include "content/renderer/media/mock_constraint_factory.h"
22 #include "content/renderer/media/mock_media_stream_dispatcher.h" 22 #include "content/renderer/media/mock_media_stream_dispatcher.h"
23 #include "content/renderer/media/mock_media_stream_video_source.h" 23 #include "content/renderer/media/mock_media_stream_video_source.h"
24 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory. h" 24 #include "content/renderer/media/webrtc/mock_peer_connection_dependency_factory. h"
25 #include "media/audio/audio_device_description.h"
26 #include "mojo/public/cpp/bindings/binding.h" 25 #include "mojo/public/cpp/bindings/binding.h"
27 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
28 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h" 27 #include "third_party/WebKit/public/platform/WebMediaDeviceInfo.h"
29 #include "third_party/WebKit/public/platform/WebMediaStream.h" 28 #include "third_party/WebKit/public/platform/WebMediaStream.h"
30 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" 29 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
31 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" 30 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
32 #include "third_party/WebKit/public/platform/WebString.h" 31 #include "third_party/WebKit/public/platform/WebString.h"
33 #include "third_party/WebKit/public/platform/WebVector.h" 32 #include "third_party/WebKit/public/platform/WebVector.h"
34 #include "third_party/WebKit/public/web/WebHeap.h" 33 #include "third_party/WebKit/public/web/WebHeap.h"
35 34
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 TestValidRequestWithConstraints(audio_constraints, video_constraints, 893 TestValidRequestWithConstraints(audio_constraints, video_constraints,
895 kFakeAudioInputDeviceId1, 894 kFakeAudioInputDeviceId1,
896 kFakeVideoInputDeviceId1); 895 kFakeVideoInputDeviceId1);
897 } 896 }
898 897
899 TEST_F(UserMediaClientImplTest, CreateWithAllOptionalInvalidDeviceId) { 898 TEST_F(UserMediaClientImplTest, CreateWithAllOptionalInvalidDeviceId) {
900 blink::WebMediaConstraints audio_constraints = 899 blink::WebMediaConstraints audio_constraints =
901 CreateDeviceConstraints(nullptr, kInvalidDeviceId, kInvalidDeviceId); 900 CreateDeviceConstraints(nullptr, kInvalidDeviceId, kInvalidDeviceId);
902 blink::WebMediaConstraints video_constraints = 901 blink::WebMediaConstraints video_constraints =
903 CreateDeviceConstraints(nullptr, kInvalidDeviceId, kInvalidDeviceId); 902 CreateDeviceConstraints(nullptr, kInvalidDeviceId, kInvalidDeviceId);
903 // MockMediaStreamDispatcher uses empty string as default audio device ID.
904 // MockMediaDevicesDispatcher uses the first device in the enumeration as 904 // MockMediaDevicesDispatcher uses the first device in the enumeration as
905 // default video device ID. 905 // default video device ID.
906 TestValidRequestWithConstraints( 906 TestValidRequestWithConstraints(audio_constraints, video_constraints,
907 audio_constraints, video_constraints, 907 std::string(), kFakeVideoInputDeviceId1);
908 std::string(media::AudioDeviceDescription::kDefaultDeviceId),
909 kFakeVideoInputDeviceId1);
910 } 908 }
911 909
912 TEST_F(UserMediaClientImplTest, CreateWithFacingModeUser) { 910 TEST_F(UserMediaClientImplTest, CreateWithFacingModeUser) {
913 blink::WebMediaConstraints audio_constraints = 911 blink::WebMediaConstraints audio_constraints =
914 CreateDeviceConstraints(kFakeAudioInputDeviceId1); 912 CreateDeviceConstraints(kFakeAudioInputDeviceId1);
915 blink::WebMediaConstraints video_constraints = 913 blink::WebMediaConstraints video_constraints =
916 CreateFacingModeConstraints("user"); 914 CreateFacingModeConstraints("user");
917 // kFakeVideoInputDeviceId1 has user facing mode. 915 // kFakeVideoInputDeviceId1 has user facing mode.
918 TestValidRequestWithConstraints(audio_constraints, video_constraints, 916 TestValidRequestWithConstraints(audio_constraints, video_constraints,
919 kFakeAudioInputDeviceId1, 917 kFakeAudioInputDeviceId1,
920 kFakeVideoInputDeviceId1); 918 kFakeVideoInputDeviceId1);
921 } 919 }
922 920
923 TEST_F(UserMediaClientImplTest, CreateWithFacingModeEnvironment) { 921 TEST_F(UserMediaClientImplTest, CreateWithFacingModeEnvironment) {
924 blink::WebMediaConstraints audio_constraints = 922 blink::WebMediaConstraints audio_constraints =
925 CreateDeviceConstraints(kFakeAudioInputDeviceId1); 923 CreateDeviceConstraints(kFakeAudioInputDeviceId1);
926 blink::WebMediaConstraints video_constraints = 924 blink::WebMediaConstraints video_constraints =
927 CreateFacingModeConstraints("environment"); 925 CreateFacingModeConstraints("environment");
928 // kFakeVideoInputDeviceId2 has environment facing mode. 926 // kFakeVideoInputDeviceId2 has environment facing mode.
929 TestValidRequestWithConstraints(audio_constraints, video_constraints, 927 TestValidRequestWithConstraints(audio_constraints, video_constraints,
930 kFakeAudioInputDeviceId1, 928 kFakeAudioInputDeviceId1,
931 kFakeVideoInputDeviceId2); 929 kFakeVideoInputDeviceId2);
932 } 930 }
933 931
934 } // namespace content 932 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/user_media_client_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698