OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/browser/web_contents/web_contents_impl.h" | 7 #include "content/browser/web_contents/web_contents_impl.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "content/public/test/browser_test_utils.h" | 9 #include "content/public/test/browser_test_utils.h" |
10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ContentBrowserTest::SetUp(); | 64 ContentBrowserTest::SetUp(); |
65 } | 65 } |
66 }; | 66 }; |
67 | 67 |
68 // The test is tagged as MANUAL since the webcam is a system-level resource; we | 68 // The test is tagged as MANUAL since the webcam is a system-level resource; we |
69 // only want it to run on bots where we can ensure sequential execution. The | 69 // only want it to run on bots where we can ensure sequential execution. The |
70 // Android bots will run the test since they ignore MANUAL, but that's what we | 70 // Android bots will run the test since they ignore MANUAL, but that's what we |
71 // want here since the bot runs tests sequentially on the device. | 71 // want here since the bot runs tests sequentially on the device. |
72 IN_PROC_BROWSER_TEST_F(WebRtcWebcamBrowserTest, | 72 IN_PROC_BROWSER_TEST_F(WebRtcWebcamBrowserTest, |
73 MANUAL_CanAcquireVgaOnRealWebcam) { | 73 MANUAL_CanAcquireVgaOnRealWebcam) { |
74 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 74 ASSERT_TRUE(embedded_test_server()->Start()); |
75 GURL url(embedded_test_server()->GetURL( | 75 GURL url(embedded_test_server()->GetURL( |
76 "/media/getusermedia-real-webcam.html")); | 76 "/media/getusermedia-real-webcam.html")); |
77 NavigateToURL(shell(), url); | 77 NavigateToURL(shell(), url); |
78 | 78 |
79 std::string result; | 79 std::string result; |
80 ASSERT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(), | 80 ASSERT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(), |
81 "hasVideoInputDeviceOnSystem()", | 81 "hasVideoInputDeviceOnSystem()", |
82 &result)); | 82 &result)); |
83 if (result != "has-video-input-device") { | 83 if (result != "has-video-input-device") { |
84 VLOG(0) << "No video device; skipping test..."; | 84 VLOG(0) << "No video device; skipping test..."; |
85 return; | 85 return; |
86 } | 86 } |
87 | 87 |
88 // GetUserMedia should acquire VGA by default. | 88 // GetUserMedia should acquire VGA by default. |
89 ASSERT_TRUE(ExecuteScriptAndExtractString( | 89 ASSERT_TRUE(ExecuteScriptAndExtractString( |
90 shell()->web_contents(), | 90 shell()->web_contents(), |
91 "getUserMediaAndReturnVideoDimensions({video: true})", | 91 "getUserMediaAndReturnVideoDimensions({video: true})", |
92 &result)); | 92 &result)); |
93 | 93 |
94 if (result == "640x480" || result == "480x640") { | 94 if (result == "640x480" || result == "480x640") { |
95 // Don't care if the device happens to be in landscape or portrait mode | 95 // Don't care if the device happens to be in landscape or portrait mode |
96 // since we don't know how it is oriented in the lab :) | 96 // since we don't know how it is oriented in the lab :) |
97 return; | 97 return; |
98 } | 98 } |
99 FAIL() << "Expected resolution to be 640x480 or 480x640, got" << result; | 99 FAIL() << "Expected resolution to be 640x480 or 480x640, got" << result; |
100 } | 100 } |
101 | 101 |
102 } // namespace content | 102 } // namespace content |
OLD | NEW |