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

Unified Diff: content/browser/media/webrtc/webrtc_webcam_browsertest.cc

Issue 2193343002: Cleanup: move content/browser/media/webrtc/ to content/browser/webrtc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/webrtc/webrtc_webcam_browsertest.cc
diff --git a/content/browser/media/webrtc/webrtc_webcam_browsertest.cc b/content/browser/media/webrtc/webrtc_webcam_browsertest.cc
deleted file mode 100644
index 5f9d7c36e8a73a908bf73973ce2dd0ee8762a53f..0000000000000000000000000000000000000000
--- a/content/browser/media/webrtc/webrtc_webcam_browsertest.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2014 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/browser/media/webrtc/webrtc_webcam_browsertest.h"
-
-#include "base/command_line.h"
-#include "base/strings/utf_string_conversions.h"
-#include "build/build_config.h"
-#include "content/browser/web_contents/web_contents_impl.h"
-#include "content/public/common/content_switches.h"
-#include "content/public/test/browser_test_utils.h"
-#include "content/public/test/content_browser_test.h"
-#include "content/public/test/content_browser_test_utils.h"
-#include "content/public/test/test_utils.h"
-#include "content/shell/browser/shell.h"
-#include "media/base/media_switches.h"
-#include "net/test/embedded_test_server/embedded_test_server.h"
-
-namespace {
-
-const base::CommandLine::StringType FAKE_DEVICE_FLAG =
-#if defined(OS_WIN)
- base::ASCIIToUTF16(switches::kUseFakeDeviceForMediaStream);
-#else
- switches::kUseFakeDeviceForMediaStream;
-#endif
-
-bool IsUseFakeDeviceForMediaStream(const base::CommandLine::StringType& arg) {
- return arg.find(FAKE_DEVICE_FLAG) != std::string::npos;
-}
-
-void RemoveFakeDeviceFromCommandLine(base::CommandLine* command_line) {
- base::CommandLine::StringVector argv = command_line->argv();
- argv.erase(std::remove_if(argv.begin(), argv.end(),
- IsUseFakeDeviceForMediaStream),
- argv.end());
- command_line->InitFromArgv(argv);
-}
-
-} // namespace
-
-namespace content {
-
-void WebRtcWebcamBrowserTest::SetUpCommandLine(
- base::CommandLine* command_line) {
- // Allows for accessing capture devices without prompting for permission.
- command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
-
- // The content_browsertests run with this flag by default, and this test is
- // the only current exception to that rule, so just remove the flag
- // --use-fake-device-for-media-stream here. We could also have all tests
- // involving media streams add this flag explicitly, but it will be really
- // unintuitive for developers to write tests involving media stream and have
- // them fail on what looks like random bots, so running with fake devices
- // is really a reasonable default.
- RemoveFakeDeviceFromCommandLine(command_line);
-}
-
-void WebRtcWebcamBrowserTest::SetUp() {
- EnablePixelOutput();
- ContentBrowserTest::SetUp();
-}
-
-// The test is tagged as MANUAL since the webcam is a system-level resource; we
-// only want it to run on bots where we can ensure sequential execution. The
-// Android bots will run the test since they ignore MANUAL, but that's what we
-// want here since the bot runs tests sequentially on the device.
-IN_PROC_BROWSER_TEST_F(WebRtcWebcamBrowserTest,
- MANUAL_CanAcquireVgaOnRealWebcam) {
- ASSERT_TRUE(embedded_test_server()->Start());
- GURL url(embedded_test_server()->GetURL(
- "/media/getusermedia-real-webcam.html"));
- NavigateToURL(shell(), url);
-
- std::string result;
- ASSERT_TRUE(ExecuteScriptAndExtractString(
- shell(), "hasVideoInputDeviceOnSystem()", &result));
- if (result != "has-video-input-device") {
- VLOG(0) << "No video device; skipping test...";
- return;
- }
-
- // GetUserMedia should acquire VGA by default.
- ASSERT_TRUE(ExecuteScriptAndExtractString(
- shell(), "getUserMediaAndReturnVideoDimensions({video: true})", &result));
-
- if (result == "640x480" || result == "480x640") {
- // Don't care if the device happens to be in landscape or portrait mode
- // since we don't know how it is oriented in the lab :)
- return;
- }
- FAIL() << "Expected resolution to be 640x480 or 480x640, got" << result;
-}
-
-} // namespace content

Powered by Google App Engine
This is Rietveld 408576698