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

Unified Diff: media/capture/video/linux/camera_facing_chromeos_unittest.cc

Issue 2558483003: Reland of rotate frames correctly for back camera (Closed)
Patch Set: fix compiler error Created 4 years 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
Index: media/capture/video/linux/camera_facing_chromeos_unittest.cc
diff --git a/media/capture/video/linux/camera_facing_chromeos_unittest.cc b/media/capture/video/linux/camera_facing_chromeos_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..05928104d67a374bc97406d6069e0c89d8aac4b8
--- /dev/null
+++ b/media/capture/video/linux/camera_facing_chromeos_unittest.cc
@@ -0,0 +1,41 @@
+// Copyright 2016 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 <string>
+
+#include "media/capture/video/linux/camera_facing_chromeos.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#include <base/files/file_util.h>
+#include <base/files/file.h>
+
+namespace media {
+
+namespace {
+
+const char kConfigFileContent[] =
+ "camera0.lens_facing=1\ncamera0.sensor_orientation=0\ncamera0.module0.usb_"
+ "vid_pid=04f2:b53a\n";
+}
+
+TEST(CameraFacingChromeOSTest, ParseSuccessfully) {
+ const char file_name[] = "fake_camera_characteristics.conf";
+ base::WriteFile(base::FilePath(file_name), kConfigFileContent,
+ sizeof(kConfigFileContent));
+
+ std::string file_name_str(file_name);
+ CameraFacingChromeOS camera_facing(file_name_str);
+ EXPECT_EQ(CameraFacingChromeOS::LensFacing::BACK,
+ camera_facing.GetCameraFacing(std::string("/dev/video2"),
+ std::string("04f2:b53a")));
+}
+
+TEST(CameraFacingChromeOSTest, ConfigFileNotExist) {
+ CameraFacingChromeOS camera_facing(std::string("file_not_exist"));
+ EXPECT_EQ(CameraFacingChromeOS::LensFacing::FRONT,
+ camera_facing.GetCameraFacing(std::string("/dev/video2"),
+ std::string("04f2:b53a")));
+}
+
+} // namespace media
« no previous file with comments | « media/capture/video/linux/camera_facing_chromeos.cc ('k') | media/capture/video/linux/video_capture_device_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698