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

Side by Side Diff: content/browser/webrtc/webrtc_webcam_browsertest.cc

Issue 2341643006: ImageCapture browser tests: use IsWebcamAvailableOnSystem() (Closed)
Patch Set: Rebase to https://crrev.com/2334223012 Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/webrtc/webrtc_webcam_browsertest.h" 5 #include "content/browser/webrtc/webrtc_webcam_browsertest.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 void WebRtcWebcamBrowserTest::SetUp() { 60 void WebRtcWebcamBrowserTest::SetUp() {
61 EnablePixelOutput(); 61 EnablePixelOutput();
62 ContentBrowserTest::SetUp(); 62 ContentBrowserTest::SetUp();
63 } 63 }
64 64
65 // The test is tagged as MANUAL since the webcam is a system-level resource; we 65 // The test is tagged as MANUAL since the webcam is a system-level resource; we
66 // only want it to run on bots where we can ensure sequential execution. The 66 // only want it to run on bots where we can ensure sequential execution. The
67 // Android bots will run the test since they ignore MANUAL, but that's what we 67 // Android bots will run the test since they ignore MANUAL, but that's what we
68 // want here since the bot runs tests sequentially on the device. 68 // want here since the bot runs tests sequentially on the device.
69 // Tests that GetUserMedia acquires VGA by default.
69 IN_PROC_BROWSER_TEST_F(WebRtcWebcamBrowserTest, 70 IN_PROC_BROWSER_TEST_F(WebRtcWebcamBrowserTest,
70 MANUAL_CanAcquireVgaOnRealWebcam) { 71 MANUAL_CanAcquireVgaOnRealWebcam) {
71 ASSERT_TRUE(embedded_test_server()->Start()); 72 ASSERT_TRUE(embedded_test_server()->Start());
72 GURL url(embedded_test_server()->GetURL( 73 GURL url(embedded_test_server()->GetURL(
73 "/media/getusermedia-real-webcam.html")); 74 "/media/getusermedia-real-webcam.html"));
74 NavigateToURL(shell(), url); 75 NavigateToURL(shell(), url);
75 76
76 std::string result;
77 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) { 77 if (!IsWebcamAvailableOnSystem(shell()->web_contents())) {
78 DVLOG(0) << "No video device; skipping test..."; 78 DVLOG(0) << "No video device; skipping test...";
79 return; 79 return;
80 } 80 }
81 81
82 // GetUserMedia should acquire VGA by default. 82 std::string result;
83 ASSERT_TRUE(ExecuteScriptAndExtractString( 83 ASSERT_TRUE(ExecuteScriptAndExtractString(
84 shell(), "getUserMediaAndReturnVideoDimensions({video: true})", &result)); 84 shell(), "getUserMediaAndReturnVideoDimensions({video: true})", &result));
85 85
86 if (result == "640x480" || result == "480x640") { 86 if (result == "640x480" || result == "480x640") {
87 // Don't care if the device happens to be in landscape or portrait mode 87 // Don't care if the device happens to be in landscape or portrait mode
88 // since we don't know how it is oriented in the lab :) 88 // since we don't know how it is oriented in the lab :)
89 return; 89 return;
90 } 90 }
91 FAIL() << "Expected resolution to be 640x480 or 480x640, got" << result; 91 FAIL() << "Expected resolution to be 640x480 or 480x640, got: " << result;
92 } 92 }
93 93
94 } // namespace content 94 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webrtc/webrtc_image_capture_browsertest.cc ('k') | content/test/data/media/image_capture_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698