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

Unified Diff: content/common/media/media_devices_unittest.cc

Issue 2650153003: Add constructors and operators to MediaDeviceInfo. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/media/media_devices.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/media/media_devices_unittest.cc
diff --git a/content/common/media/media_devices_unittest.cc b/content/common/media/media_devices_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d6fd624f245f64f40f3fcafba3870542bdb93d3d
--- /dev/null
+++ b/content/common/media/media_devices_unittest.cc
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/common/media/media_devices.h"
+#include "media/audio/audio_device_description.h"
+#include "media/capture/video/video_capture_device_descriptor.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace content {
+
+TEST(MediaDevicesTest, MediaDeviceInfoFromAudioDescription) {
+ const std::string kFakeDeviceID = "fake_device_id";
+ const std::string kFakeLabel = "fake_label";
+ const std::string kFakeGroupID = "fake_group_id";
+
+ media::AudioDeviceDescription description(kFakeLabel, kFakeDeviceID,
+ kFakeGroupID);
+ MediaDeviceInfo device_info(description);
+ EXPECT_EQ(kFakeDeviceID, device_info.device_id);
+ EXPECT_EQ(kFakeLabel, device_info.label);
+ EXPECT_EQ(kFakeGroupID, device_info.group_id);
+}
+
+TEST(MediaDevicesTest, MediaDeviceInfoFromVideoDescriptor) {
+ media::VideoCaptureDeviceDescriptor descriptor(
+ "display_name", "device_id", "model_id", media::VideoCaptureApi::UNKNOWN);
+
+ // TODO(guidou): Add test for group ID when supported. See crbug.com/627793.
+ MediaDeviceInfo device_info(descriptor);
+ EXPECT_EQ(descriptor.device_id, device_info.device_id);
+ EXPECT_EQ(descriptor.GetNameAndModel(), device_info.label);
+}
+
+} // namespace content
« no previous file with comments | « content/common/media/media_devices.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698