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

Side by Side Diff: content/browser/media/webrtc_browsertest.cc

Issue 131203005: Split WebRTC browser tests in getusermedia and peerconnection tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/json/json_reader.h"
7 #include "base/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/trace_event_analyzer.h"
10 #include "base/values.h" 7 #include "base/values.h"
8 #include "content/browser/media/webrtc_content_browsertest_base.h"
11 #include "content/browser/media/webrtc_internals.h" 9 #include "content/browser/media/webrtc_internals.h"
12 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
13 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
14 #include "content/public/test/browser_test_utils.h" 12 #include "content/public/test/browser_test_utils.h"
15 #include "content/public/test/test_utils.h" 13 #include "content/public/test/test_utils.h"
16 #include "content/shell/browser/shell.h" 14 #include "content/shell/browser/shell.h"
17 #include "content/test/content_browser_test.h"
18 #include "content/test/content_browser_test_utils.h" 15 #include "content/test/content_browser_test_utils.h"
19 #include "media/audio/audio_manager.h" 16 #include "media/audio/audio_manager.h"
20 #include "net/test/embedded_test_server/embedded_test_server.h" 17 #include "net/test/embedded_test_server/embedded_test_server.h"
21 #include "testing/perf/perf_test.h"
22 18
23 #if defined(OS_WIN) 19 #if defined(OS_WIN)
24 #include "base/win/windows_version.h" 20 #include "base/win/windows_version.h"
25 #endif 21 #endif
26 22
27 using trace_analyzer::TraceAnalyzer;
28 using trace_analyzer::Query;
29 using trace_analyzer::TraceEventVector;
30
31 namespace {
32
33 static const char kGetUserMediaAndStop[] = "getUserMediaAndStop";
34 static const char kGetUserMediaAndWaitAndStop[] = "getUserMediaAndWaitAndStop";
35 static const char kGetUserMediaAndAnalyseAndStop[] =
36 "getUserMediaAndAnalyseAndStop";
37
38 // Results returned by JS.
39 static const char kOK[] = "OK";
40 static const char kGetUserMediaFailed[] =
41 "GetUserMedia call failed with code undefined";
42
43 std::string GenerateGetUserMediaCall(const char* function_name,
44 int min_width,
45 int max_width,
46 int min_height,
47 int max_height,
48 int min_frame_rate,
49 int max_frame_rate) {
50 return base::StringPrintf(
51 "%s({video: {mandatory: {minWidth: %d, maxWidth: %d, "
52 "minHeight: %d, maxHeight: %d, minFrameRate: %d, maxFrameRate: %d}, "
53 "optional: []}});",
54 function_name,
55 min_width,
56 max_width,
57 min_height,
58 max_height,
59 min_frame_rate,
60 max_frame_rate);
61 }
62
63 std::string GenerateGetUserMediaWithMandatorySourceID(
64 const std::string& function_name,
65 const std::string& audio_source_id,
66 const std::string& video_source_id) {
67 const std::string audio_constraint =
68 "audio: {mandatory: { sourceId:\"" + audio_source_id + "\"}}, ";
69
70 const std::string video_constraint =
71 "video: {mandatory: { sourceId:\"" + video_source_id + "\"}}";
72 return function_name + "({" + audio_constraint + video_constraint + "});";
73 }
74
75 std::string GenerateGetUserMediaWithOptionalSourceID(
76 const std::string& function_name,
77 const std::string& audio_source_id,
78 const std::string& video_source_id) {
79 const std::string audio_constraint =
80 "audio: {optional: [{sourceId:\"" + audio_source_id + "\"}]}, ";
81
82 const std::string video_constraint =
83 "video: {optional: [{ sourceId:\"" + video_source_id + "\"}]}";
84 return function_name + "({" + audio_constraint + video_constraint + "});";
85 }
86
87 }
88
89 namespace content { 23 namespace content {
90 24
91 class WebrtcBrowserTest: public ContentBrowserTest { 25 class WebRtcBrowserTest: public WebRtcContentBrowserTest {
92 public: 26 public:
93 WebrtcBrowserTest() : trace_log_(NULL) {} 27 WebRtcBrowserTest() {}
94 virtual ~WebrtcBrowserTest() {} 28 virtual ~WebRtcBrowserTest() {}
95
96 virtual void SetUp() OVERRIDE {
97 // These tests require pixel output.
98 UseRealGLContexts();
99 ContentBrowserTest::SetUp();
100 }
101
102 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
103 // We need fake devices in this test since we want to run on naked VMs. We
104 // assume these switches are set by default in content_browsertests.
105 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
106 switches::kUseFakeDeviceForMediaStream));
107 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
108 switches::kUseFakeUIForMediaStream));
109 }
110
111 void StartTracing() {
112 CHECK(trace_log_ == NULL) << "Can only can start tracing once";
113 trace_log_ = base::debug::TraceLog::GetInstance();
114 trace_log_->SetEnabled(base::debug::CategoryFilter("video"),
115 base::debug::TraceLog::RECORDING_MODE,
116 base::debug::TraceLog::ENABLE_SAMPLING);
117 // Check that we are indeed recording.
118 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1);
119 }
120
121 void StopTracing() {
122 CHECK(message_loop_runner_ == NULL) << "Calling StopTracing more than once";
123 trace_log_->SetDisabled();
124 message_loop_runner_ = new MessageLoopRunner;
125 trace_log_->Flush(base::Bind(&WebrtcBrowserTest::OnTraceDataCollected,
126 base::Unretained(this)));
127 message_loop_runner_->Run();
128 }
129
130 void OnTraceDataCollected(
131 const scoped_refptr<base::RefCountedString>& events_str_ptr,
132 bool has_more_events) {
133 CHECK(!has_more_events);
134 recorded_trace_data_ = events_str_ptr;
135 message_loop_runner_->Quit();
136 }
137
138 TraceAnalyzer* CreateTraceAnalyzer() {
139 return TraceAnalyzer::Create("[" + recorded_trace_data_->data() + "]");
140 }
141
142 void GetSources(std::vector<std::string>* audio_ids,
143 std::vector<std::string>* video_ids) {
144 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
145 NavigateToURL(shell(), url);
146
147 std::string sources_as_json = ExecuteJavascriptAndReturnResult(
148 "getSources()");
149 EXPECT_FALSE(sources_as_json.empty());
150
151 int error_code;
152 std::string error_message;
153 scoped_ptr<base::Value> value(
154 base::JSONReader::ReadAndReturnError(sources_as_json,
155 base::JSON_ALLOW_TRAILING_COMMAS,
156 &error_code,
157 &error_message));
158
159 ASSERT_TRUE(value.get() != NULL) << error_message;
160 EXPECT_EQ(value->GetType(), base::Value::TYPE_LIST);
161
162 base::ListValue* values;
163 ASSERT_TRUE(value->GetAsList(&values));
164
165 for (base::ListValue::iterator it = values->begin();
166 it != values->end(); ++it) {
167 const base::DictionaryValue* dict;
168 std::string kind;
169 std::string id;
170 ASSERT_TRUE((*it)->GetAsDictionary(&dict));
171 ASSERT_TRUE(dict->GetString("kind", &kind));
172 ASSERT_TRUE(dict->GetString("id", &id));
173 ASSERT_FALSE(id.empty());
174 EXPECT_TRUE(kind == "audio" || kind == "video");
175 if (kind == "audio") {
176 audio_ids->push_back(id);
177 } else if (kind == "video") {
178 video_ids->push_back(id);
179 }
180 }
181 ASSERT_FALSE(audio_ids->empty());
182 ASSERT_FALSE(video_ids->empty());
183 }
184
185 protected:
186 bool ExecuteJavascript(const std::string& javascript) {
187 return ExecuteScript(shell()->web_contents(), javascript);
188 }
189
190 // Executes |javascript|. The script is required to use
191 // window.domAutomationController.send to send a string value back to here.
192 std::string ExecuteJavascriptAndReturnResult(const std::string& javascript) {
193 std::string result;
194 EXPECT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(),
195 javascript,
196 &result));
197 return result;
198 }
199
200 void ExpectTitle(const std::string& expected_title) const {
201 base::string16 expected_title16(base::ASCIIToUTF16(expected_title));
202 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
203 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
204 }
205 29
206 // Convenience function since most peerconnection-call.html tests just load 30 // Convenience function since most peerconnection-call.html tests just load
207 // the page, kick off some javascript and wait for the title to change to OK. 31 // the page, kick off some javascript and wait for the title to change to OK.
208 void MakeTypicalPeerConnectionCall(const std::string& javascript) { 32 void MakeTypicalPeerConnectionCall(const std::string& javascript) {
209 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 33 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
210 34
211 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 35 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
212 NavigateToURL(shell(), url); 36 NavigateToURL(shell(), url);
213 ExecuteTestAndWaitForOk(javascript); 37 ExecuteTestAndWaitForOk(javascript);
214 } 38 }
215 39
216 void ExecuteTestAndWaitForOk(const std::string& javascript) { 40 void ExecuteTestAndWaitForOk(const std::string& javascript) {
217 #if defined (OS_ANDROID) 41 #if defined (OS_ANDROID)
218 // Always force iSAC 16K on Android for now (Opus is broken). 42 // Always force iSAC 16K on Android for now (Opus is broken).
219 ASSERT_TRUE(ExecuteJavascript("forceIsac16KInSdp();")); 43 ASSERT_TRUE(ExecuteJavascript("forceIsac16KInSdp();"));
220 #endif 44 #endif
221 45
222 ASSERT_TRUE(ExecuteJavascript(javascript)); 46 ASSERT_TRUE(ExecuteJavascript(javascript));
223 ExpectTitle("OK"); 47 ExpectTitle("OK");
224 } 48 }
225
226 private:
227 base::debug::TraceLog* trace_log_;
228 scoped_refptr<base::RefCountedString> recorded_trace_data_;
229 scoped_refptr<MessageLoopRunner> message_loop_runner_;
230 }; 49 };
231 50
232 // These tests will all make a getUserMedia call with different constraints and
233 // see that the success callback is called. If the error callback is called or
234 // none of the callbacks are called the tests will simply time out and fail.
235 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetVideoStreamAndStop) {
236 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
237
238 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
239 NavigateToURL(shell(), url);
240
241 ASSERT_TRUE(ExecuteJavascript(
242 base::StringPrintf("%s({video: true});", kGetUserMediaAndStop)));
243
244 ExpectTitle("OK");
245 }
246
247 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetAudioAndVideoStreamAndStop) {
248 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
249
250 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
251 NavigateToURL(shell(), url);
252
253 ASSERT_TRUE(ExecuteJavascript(base::StringPrintf(
254 "%s({video: true, audio: true});", kGetUserMediaAndStop)));
255
256 ExpectTitle("OK");
257 }
258
259 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetAudioAndVideoStreamAndClone) {
260 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
261
262 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
263 NavigateToURL(shell(), url);
264
265 ASSERT_TRUE(ExecuteJavascript("getUserMediaAndClone();"));
266
267 ExpectTitle("OK");
268 }
269
270 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetUserMediaWithMandatorySourceID_1) {
271 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
272
273 std::vector<std::string> audio_ids;
274 std::vector<std::string> video_ids;
275 GetSources(&audio_ids, &video_ids);
276
277 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
278 NavigateToURL(shell(), url);
279
280 for (size_t j = 0; j < video_ids.size() / 2; ++j) {
281 for (size_t i = 0; i < audio_ids.size(); ++i) {
282 EXPECT_EQ(kOK,
283 ExecuteJavascriptAndReturnResult(
284 GenerateGetUserMediaWithMandatorySourceID(
285 kGetUserMediaAndStop, audio_ids[i], video_ids[j])));
286 }
287 }
288 }
289
290 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetUserMediaWithMandatorySourceID_2) {
291 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
292
293 std::vector<std::string> audio_ids;
294 std::vector<std::string> video_ids;
295 GetSources(&audio_ids, &video_ids);
296
297 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
298 NavigateToURL(shell(), url);
299
300 for (size_t j = video_ids.size() / 2; j < video_ids.size(); ++j) {
301 for (size_t i = 0; i < audio_ids.size(); ++i) {
302 EXPECT_EQ(kOK,
303 ExecuteJavascriptAndReturnResult(
304 GenerateGetUserMediaWithMandatorySourceID(
305 kGetUserMediaAndStop, audio_ids[i], video_ids[j])));
306 }
307 }
308 }
309
310 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
311 GetUserMediaWithInvalidMandatorySourceID) {
312 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
313
314 std::vector<std::string> audio_ids;
315 std::vector<std::string> video_ids;
316 GetSources(&audio_ids, &video_ids);
317
318 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
319
320 // Test with invalid mandatory audio sourceID.
321 NavigateToURL(shell(), url);
322 EXPECT_EQ(kGetUserMediaFailed,
323 ExecuteJavascriptAndReturnResult(
324 GenerateGetUserMediaWithMandatorySourceID(
325 kGetUserMediaAndStop, "something invalid", video_ids[0])));
326
327 // Test with invalid mandatory video sourceID.
328 EXPECT_EQ(kGetUserMediaFailed,
329 ExecuteJavascriptAndReturnResult(
330 GenerateGetUserMediaWithMandatorySourceID(
331 kGetUserMediaAndStop, audio_ids[0], "something invalid")));
332
333 // Test with empty mandatory audio sourceID.
334 EXPECT_EQ(kGetUserMediaFailed,
335 ExecuteJavascriptAndReturnResult(
336 GenerateGetUserMediaWithMandatorySourceID(
337 kGetUserMediaAndStop, "", video_ids[0])));
338 }
339
340 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetUserMediaWithOptionalSourceID_1) {
341 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
342
343 std::vector<std::string> audio_ids;
344 std::vector<std::string> video_ids;
345 GetSources(&audio_ids, &video_ids);
346
347 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
348 NavigateToURL(shell(), url);
349
350 // Test all combinations of mandatory sourceID.
351 for (size_t j = 0; j < video_ids.size() / 2; ++j) {
352 for (size_t i = 0; i < audio_ids.size(); ++i) {
353 EXPECT_EQ(kOK,
354 ExecuteJavascriptAndReturnResult(
355 GenerateGetUserMediaWithOptionalSourceID(
356 kGetUserMediaAndStop, audio_ids[i], video_ids[j])));
357 }
358 }
359 }
360
361 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, GetUserMediaWithOptionalSourceID_2) {
362 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
363
364 std::vector<std::string> audio_ids;
365 std::vector<std::string> video_ids;
366 GetSources(&audio_ids, &video_ids);
367
368 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
369 NavigateToURL(shell(), url);
370
371 // Test all combinations of mandatory sourceID.
372 for (size_t j = video_ids.size() / 2; j < video_ids.size(); ++j) {
373 for (size_t i = 0; i < audio_ids.size(); ++i) {
374 EXPECT_EQ(kOK,
375 ExecuteJavascriptAndReturnResult(
376 GenerateGetUserMediaWithOptionalSourceID(
377 kGetUserMediaAndStop, audio_ids[i], video_ids[j])));
378 }
379 }
380 }
381
382 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
383 GetUserMediaWithInvalidOptionalSourceID) {
384 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
385
386 std::vector<std::string> audio_ids;
387 std::vector<std::string> video_ids;
388 GetSources(&audio_ids, &video_ids);
389
390 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
391
392 // Test with invalid optional audio sourceID.
393 NavigateToURL(shell(), url);
394 EXPECT_EQ(
395 kOK,
396 ExecuteJavascriptAndReturnResult(GenerateGetUserMediaWithOptionalSourceID(
397 kGetUserMediaAndStop, "something invalid", video_ids[0])));
398
399 // Test with invalid optional video sourceID.
400 EXPECT_EQ(
401 kOK,
402 ExecuteJavascriptAndReturnResult(GenerateGetUserMediaWithOptionalSourceID(
403 kGetUserMediaAndStop, audio_ids[0], "something invalid")));
404
405 // Test with empty optional audio sourceID.
406 EXPECT_EQ(
407 kOK,
408 ExecuteJavascriptAndReturnResult(GenerateGetUserMediaWithOptionalSourceID(
409 kGetUserMediaAndStop, "", video_ids[0])));
410 }
411
412 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
413 // Timing out on ARM linux bot: http://crbug.com/238490 52 // Timing out on ARM linux bot: http://crbug.com/238490
414 #define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall 53 #define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall
415 #else 54 #else
416 #define MAYBE_CanSetupVideoCall CanSetupVideoCall 55 #define MAYBE_CanSetupVideoCall CanSetupVideoCall
417 #endif 56 #endif
418 57
419 // These tests will make a complete PeerConnection-based call and verify that 58 // These tests will make a complete PeerConnection-based call and verify that
420 // video is playing for the call. 59 // video is playing for the call.
421 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CanSetupVideoCall) { 60 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CanSetupVideoCall) {
422 MakeTypicalPeerConnectionCall("call({video: true});"); 61 MakeTypicalPeerConnectionCall("call({video: true});");
423 } 62 }
424 63
425 // This test will make a simple getUserMedia page, verify that video is playing
426 // in a simple local <video>, and for a couple of seconds, collect some
427 // performance traces.
428 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, TracePerformanceDuringGetUserMedia) {
429 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
430
431 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
432 NavigateToURL(shell(), url);
433 // Put getUserMedia to work and let it run for a couple of seconds.
434 ASSERT_TRUE(ExecuteJavascript(base::StringPrintf(
435 "%s({video: true}, 10);", kGetUserMediaAndWaitAndStop)));
436
437 // Make sure the stream is up and running, then start collecting traces.
438 ExpectTitle("Running...");
439 StartTracing();
440
441 // Wait until the page title changes to "OK". Do not sleep() here since that
442 // would stop both this code and the browser underneath.
443 ExpectTitle("OK");
444 StopTracing();
445
446 scoped_ptr<TraceAnalyzer> analyzer(CreateTraceAnalyzer());
447 analyzer->AssociateBeginEndEvents();
448 trace_analyzer::TraceEventVector events;
449 analyzer->FindEvents(
450 Query::EventNameIs("VideoCaptureController::OnIncomingCapturedFrame"),
451 &events);
452 ASSERT_GT(events.size(), 0u)
453 << "Could not collect any samples during test, this is bad";
454
455 std::string duration_us;
456 std::string interarrival_us;
457 for (size_t i = 0; i != events.size(); ++i) {
458 duration_us.append(
459 base::StringPrintf("%d,", static_cast<int>(events[i]->duration)));
460 }
461
462 for (size_t i = 1; i < events.size(); ++i) {
463 interarrival_us.append(base::StringPrintf(
464 "%d,",
465 static_cast<int>(events[i]->timestamp - events[i - 1]->timestamp)));
466 }
467
468 perf_test::PrintResultList(
469 "video_capture", "", "sample_duration", duration_us, "us", true);
470
471 perf_test::PrintResultList(
472 "video_capture", "", "interarrival_time", interarrival_us, "us", true);
473 }
474
475 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 64 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
476 // Timing out on ARM linux, see http://crbug.com/240376 65 // Timing out on ARM linux, see http://crbug.com/240376
477 #define MAYBE_CanSetupAudioAndVideoCall DISABLED_CanSetupAudioAndVideoCall 66 #define MAYBE_CanSetupAudioAndVideoCall DISABLED_CanSetupAudioAndVideoCall
478 #else 67 #else
479 #define MAYBE_CanSetupAudioAndVideoCall CanSetupAudioAndVideoCall 68 #define MAYBE_CanSetupAudioAndVideoCall CanSetupAudioAndVideoCall
480 #endif 69 #endif
481 70
482 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CanSetupAudioAndVideoCall) { 71 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CanSetupAudioAndVideoCall) {
483 MakeTypicalPeerConnectionCall("call({video: true, audio: true});"); 72 MakeTypicalPeerConnectionCall("call({video: true, audio: true});");
484 } 73 }
485 74
486 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MANUAL_CanSetupCallAndSendDtmf) { 75 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MANUAL_CanSetupCallAndSendDtmf) {
487 MakeTypicalPeerConnectionCall("callAndSendDtmf(\'123,abc\');"); 76 MakeTypicalPeerConnectionCall("callAndSendDtmf(\'123,abc\');");
488 } 77 }
489 78
490 // TODO(phoglund): this test fails because the peer connection state will be 79 // TODO(phoglund): this test fails because the peer connection state will be
491 // stable in the second negotiation round rather than have-local-offer. 80 // stable in the second negotiation round rather than have-local-offer.
492 // http://crbug.com/293125. 81 // http://crbug.com/293125.
493 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, 82 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
494 DISABLED_CanMakeEmptyCallThenAddStreamsAndRenegotiate) { 83 DISABLED_CanMakeEmptyCallThenAddStreamsAndRenegotiate) {
495 const char* kJavascript = 84 const char* kJavascript =
496 "callEmptyThenAddOneStreamAndRenegotiate({video: true, audio: true});"; 85 "callEmptyThenAddOneStreamAndRenegotiate({video: true, audio: true});";
497 MakeTypicalPeerConnectionCall(kJavascript); 86 MakeTypicalPeerConnectionCall(kJavascript);
498 } 87 }
499 88
500 // Below 2 test will make a complete PeerConnection-based call between pc1 and 89 // Below 2 test will make a complete PeerConnection-based call between pc1 and
501 // pc2, and then use the remote stream to setup a call between pc3 and pc4, and 90 // pc2, and then use the remote stream to setup a call between pc3 and pc4, and
502 // then verify that video is received on pc3 and pc4. 91 // then verify that video is received on pc3 and pc4.
503 // Flaky on win xp. http://crbug.com/304775 92 // Flaky on win xp. http://crbug.com/304775
504 #if defined(OS_WIN) 93 #if defined(OS_WIN)
505 #define MAYBE_CanForwardRemoteStream DISABLED_CanForwardRemoteStream 94 #define MAYBE_CanForwardRemoteStream DISABLED_CanForwardRemoteStream
506 #define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p 95 #define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p
507 #else 96 #else
508 #define MAYBE_CanForwardRemoteStream CanForwardRemoteStream 97 #define MAYBE_CanForwardRemoteStream CanForwardRemoteStream
509 #define MAYBE_CanForwardRemoteStream720p CanForwardRemoteStream720p 98 #define MAYBE_CanForwardRemoteStream720p CanForwardRemoteStream720p
510 #endif 99 #endif
511 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CanForwardRemoteStream) { 100 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CanForwardRemoteStream) {
512 MakeTypicalPeerConnectionCall( 101 MakeTypicalPeerConnectionCall(
513 "callAndForwardRemoteStream({video: true, audio: true});"); 102 "callAndForwardRemoteStream({video: true, audio: true});");
514 } 103 }
515 104
516 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CanForwardRemoteStream720p) { 105 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CanForwardRemoteStream720p) {
517 const std::string javascript = GenerateGetUserMediaCall( 106 const std::string javascript = GenerateGetUserMediaCall(
518 "callAndForwardRemoteStream", 1280, 1280, 720, 720, 30, 30); 107 "callAndForwardRemoteStream", 1280, 1280, 720, 720, 30, 30);
519 MakeTypicalPeerConnectionCall(javascript); 108 MakeTypicalPeerConnectionCall(javascript);
520 } 109 }
521 110
522 // This test will make a complete PeerConnection-based call but remove the 111 // This test will make a complete PeerConnection-based call but remove the
523 // MSID and bundle attribute from the initial offer to verify that 112 // MSID and bundle attribute from the initial offer to verify that
524 // video is playing for the call even if the initiating client don't support 113 // video is playing for the call even if the initiating client don't support
525 // MSID. http://tools.ietf.org/html/draft-alvestrand-rtcweb-msid-02 114 // MSID. http://tools.ietf.org/html/draft-alvestrand-rtcweb-msid-02
526 #if defined(OS_WIN) 115 #if defined(OS_WIN)
527 // Disabled for win, see http://crbug.com/235089. 116 // Disabled for win, see http://crbug.com/235089.
528 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\ 117 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
529 DISABLED_CanSetupAudioAndVideoCallWithoutMsidAndBundle 118 DISABLED_CanSetupAudioAndVideoCallWithoutMsidAndBundle
530 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 119 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
531 // Timing out on ARM linux, see http://crbug.com/240373 120 // Timing out on ARM linux, see http://crbug.com/240373
532 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\ 121 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
533 DISABLED_CanSetupAudioAndVideoCallWithoutMsidAndBundle 122 DISABLED_CanSetupAudioAndVideoCallWithoutMsidAndBundle
534 #else 123 #else
535 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\ 124 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
536 CanSetupAudioAndVideoCallWithoutMsidAndBundle 125 CanSetupAudioAndVideoCallWithoutMsidAndBundle
537 #endif 126 #endif
538 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, 127 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
539 MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle) { 128 MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle) {
540 MakeTypicalPeerConnectionCall("callWithoutMsidAndBundle();"); 129 MakeTypicalPeerConnectionCall("callWithoutMsidAndBundle();");
541 } 130 }
542 131
543 // This test will modify the SDP offer to an unsupported codec, which should 132 // This test will modify the SDP offer to an unsupported codec, which should
544 // cause SetLocalDescription to fail. 133 // cause SetLocalDescription to fail.
545 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, NegotiateUnsupportedVideoCodec) { 134 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, NegotiateUnsupportedVideoCodec) {
546 MakeTypicalPeerConnectionCall("negotiateUnsupportedVideoCodec();"); 135 MakeTypicalPeerConnectionCall("negotiateUnsupportedVideoCodec();");
547 } 136 }
548 137
549 // This test will modify the SDP offer to use no encryption, which should 138 // This test will modify the SDP offer to use no encryption, which should
550 // cause SetLocalDescription to fail. 139 // cause SetLocalDescription to fail.
551 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, NegotiateNonCryptoCall) { 140 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, NegotiateNonCryptoCall) {
552 MakeTypicalPeerConnectionCall("negotiateNonCryptoCall();"); 141 MakeTypicalPeerConnectionCall("negotiateNonCryptoCall();");
553 } 142 }
554 143
555 // This test can negotiate an SDP offer that includes a b=AS:xx to control 144 // This test can negotiate an SDP offer that includes a b=AS:xx to control
556 // the bandwidth for audio and video 145 // the bandwidth for audio and video
557 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, NegotiateOfferWithBLine) { 146 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, NegotiateOfferWithBLine) {
558 MakeTypicalPeerConnectionCall("negotiateOfferWithBLine();"); 147 MakeTypicalPeerConnectionCall("negotiateOfferWithBLine();");
559 } 148 }
560 149
561 // This test will make a complete PeerConnection-based call using legacy SDP 150 // This test will make a complete PeerConnection-based call using legacy SDP
562 // settings: GIce, external SDES, and no BUNDLE. 151 // settings: GIce, external SDES, and no BUNDLE.
563 #if defined(OS_WIN) 152 #if defined(OS_WIN)
564 // Disabled for win7, see http://crbug.com/235089. 153 // Disabled for win7, see http://crbug.com/235089.
565 #define MAYBE_CanSetupLegacyCall DISABLED_CanSetupLegacyCall 154 #define MAYBE_CanSetupLegacyCall DISABLED_CanSetupLegacyCall
566 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 155 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
567 // Timing out on ARM linux, see http://crbug.com/240373 156 // Timing out on ARM linux, see http://crbug.com/240373
568 #define MAYBE_CanSetupLegacyCall DISABLED_CanSetupLegacyCall 157 #define MAYBE_CanSetupLegacyCall DISABLED_CanSetupLegacyCall
569 #else 158 #else
570 #define MAYBE_CanSetupLegacyCall CanSetupLegacyCall 159 #define MAYBE_CanSetupLegacyCall CanSetupLegacyCall
571 #endif 160 #endif
572 161
573 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CanSetupLegacyCall) { 162 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CanSetupLegacyCall) {
574 MakeTypicalPeerConnectionCall("callWithLegacySdp();"); 163 MakeTypicalPeerConnectionCall("callWithLegacySdp();");
575 } 164 }
576 165
577 // This test will make a PeerConnection-based call and test an unreliable text 166 // This test will make a PeerConnection-based call and test an unreliable text
578 // dataChannel. 167 // dataChannel.
579 // TODO(mallinath) - Remove this test after rtp based data channel is disabled. 168 // TODO(mallinath) - Remove this test after rtp based data channel is disabled.
580 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, CallWithDataOnly) { 169 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, CallWithDataOnly) {
581 MakeTypicalPeerConnectionCall("callWithDataOnly();"); 170 MakeTypicalPeerConnectionCall("callWithDataOnly();");
582 } 171 }
583 172
584 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, CallWithSctpDataOnly) { 173 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, CallWithSctpDataOnly) {
585 MakeTypicalPeerConnectionCall("callWithSctpDataOnly();"); 174 MakeTypicalPeerConnectionCall("callWithSctpDataOnly();");
586 } 175 }
587 176
588 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 177 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
589 // Timing out on ARM linux bot: http://crbug.com/238490 178 // Timing out on ARM linux bot: http://crbug.com/238490
590 #define MAYBE_CallWithDataAndMedia DISABLED_CallWithDataAndMedia 179 #define MAYBE_CallWithDataAndMedia DISABLED_CallWithDataAndMedia
591 #else 180 #else
592 #define MAYBE_CallWithDataAndMedia CallWithDataAndMedia 181 #define MAYBE_CallWithDataAndMedia CallWithDataAndMedia
593 #endif 182 #endif
594 183
595 // This test will make a PeerConnection-based call and test an unreliable text 184 // This test will make a PeerConnection-based call and test an unreliable text
596 // dataChannel and audio and video tracks. 185 // dataChannel and audio and video tracks.
597 // TODO(mallinath) - Remove this test after rtp based data channel is disabled. 186 // TODO(mallinath) - Remove this test after rtp based data channel is disabled.
598 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithDataAndMedia) { 187 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CallWithDataAndMedia) {
599 MakeTypicalPeerConnectionCall("callWithDataAndMedia();"); 188 MakeTypicalPeerConnectionCall("callWithDataAndMedia();");
600 } 189 }
601 190
602 191
603 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 192 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
604 // Timing out on ARM linux bot: http://crbug.com/238490 193 // Timing out on ARM linux bot: http://crbug.com/238490
605 #define MAYBE_CallWithSctpDataAndMedia DISABLED_CallWithSctpDataAndMedia 194 #define MAYBE_CallWithSctpDataAndMedia DISABLED_CallWithSctpDataAndMedia
606 #else 195 #else
607 #define MAYBE_CallWithSctpDataAndMedia CallWithSctpDataAndMedia 196 #define MAYBE_CallWithSctpDataAndMedia CallWithSctpDataAndMedia
608 #endif 197 #endif
609 198
610 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, 199 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
611 MAYBE_CallWithSctpDataAndMedia) { 200 MAYBE_CallWithSctpDataAndMedia) {
612 MakeTypicalPeerConnectionCall("callWithSctpDataAndMedia();"); 201 MakeTypicalPeerConnectionCall("callWithSctpDataAndMedia();");
613 } 202 }
614 203
615 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 204 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
616 // Timing out on ARM linux bot: http://crbug.com/238490 205 // Timing out on ARM linux bot: http://crbug.com/238490
617 #define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia 206 #define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia
618 #else 207 #else
619 // Temporarily disable the test on all platforms. http://crbug.com/293252 208 // Temporarily disable the test on all platforms. http://crbug.com/293252
620 #define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia 209 #define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia
621 #endif 210 #endif
622 211
623 // This test will make a PeerConnection-based call and test an unreliable text 212 // This test will make a PeerConnection-based call and test an unreliable text
624 // dataChannel and later add an audio and video track. 213 // dataChannel and later add an audio and video track.
625 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithDataAndLaterAddMedia) { 214 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CallWithDataAndLaterAddMedia) {
626 MakeTypicalPeerConnectionCall("callWithDataAndLaterAddMedia();"); 215 MakeTypicalPeerConnectionCall("callWithDataAndLaterAddMedia();");
627 } 216 }
628 217
629 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 218 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
630 // Timing out on ARM linux bot: http://crbug.com/238490 219 // Timing out on ARM linux bot: http://crbug.com/238490
631 #define MAYBE_CallWithNewVideoMediaStream DISABLED_CallWithNewVideoMediaStream 220 #define MAYBE_CallWithNewVideoMediaStream DISABLED_CallWithNewVideoMediaStream
632 #else 221 #else
633 #define MAYBE_CallWithNewVideoMediaStream CallWithNewVideoMediaStream 222 #define MAYBE_CallWithNewVideoMediaStream CallWithNewVideoMediaStream
634 #endif 223 #endif
635 224
636 // This test will make a PeerConnection-based call and send a new Video 225 // This test will make a PeerConnection-based call and send a new Video
637 // MediaStream that has been created based on a MediaStream created with 226 // MediaStream that has been created based on a MediaStream created with
638 // getUserMedia. 227 // getUserMedia.
639 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithNewVideoMediaStream) { 228 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CallWithNewVideoMediaStream) {
640 MakeTypicalPeerConnectionCall("callWithNewVideoMediaStream();"); 229 MakeTypicalPeerConnectionCall("callWithNewVideoMediaStream();");
641 } 230 }
642 231
643 // This test will make a PeerConnection-based call and send a new Video 232 // This test will make a PeerConnection-based call and send a new Video
644 // MediaStream that has been created based on a MediaStream created with 233 // MediaStream that has been created based on a MediaStream created with
645 // getUserMedia. When video is flowing, the VideoTrack is removed and an 234 // getUserMedia. When video is flowing, the VideoTrack is removed and an
646 // AudioTrack is added instead. 235 // AudioTrack is added instead.
647 // TODO(phoglund): This test is manual since not all buildbots has an audio 236 // TODO(phoglund): This test is manual since not all buildbots has an audio
648 // input. 237 // input.
649 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MANUAL_CallAndModifyStream) { 238 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MANUAL_CallAndModifyStream) {
650 MakeTypicalPeerConnectionCall( 239 MakeTypicalPeerConnectionCall(
651 "callWithNewVideoMediaStreamLaterSwitchToAudio();"); 240 "callWithNewVideoMediaStreamLaterSwitchToAudio();");
652 } 241 }
653 242
654 namespace { 243 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, AddTwoMediaStreamsToOnePC) {
655
656 struct UserMediaSizes {
657 int min_width;
658 int max_width;
659 int min_height;
660 int max_height;
661 int min_frame_rate;
662 int max_frame_rate;
663 };
664
665 } // namespace
666
667 class WebrtcUserMediaBrowserTest
668 : public WebrtcBrowserTest,
669 public testing::WithParamInterface<UserMediaSizes> {
670 public:
671 WebrtcUserMediaBrowserTest() : user_media_(GetParam()) {}
672 const UserMediaSizes& user_media() const { return user_media_; }
673
674 private:
675 UserMediaSizes user_media_;
676 };
677
678 // This test calls getUserMedia in sequence with different constraints.
679 IN_PROC_BROWSER_TEST_P(WebrtcUserMediaBrowserTest, GetUserMediaConstraints) {
680 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
681
682 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
683
684 std::string call = GenerateGetUserMediaCall(kGetUserMediaAndStop,
685 user_media().min_width,
686 user_media().max_width,
687 user_media().min_height,
688 user_media().max_height,
689 user_media().min_frame_rate,
690 user_media().max_frame_rate);
691 DVLOG(1) << "Calling getUserMedia: " << call;
692 NavigateToURL(shell(), url);
693 ASSERT_TRUE(ExecuteJavascript(call));
694 ExpectTitle("OK");
695 }
696
697 static const UserMediaSizes kAllUserMediaSizes[] = {
698 {320, 320, 180, 180, 30, 30},
699 {320, 320, 240, 240, 30, 30},
700 {640, 640, 360, 360, 30, 30},
701 {640, 640, 480, 480, 30, 30},
702 {960, 960, 720, 720, 30, 30},
703 {1280, 1280, 720, 720, 30, 30},
704 {1920, 1920, 1080, 1080, 30, 30}};
705
706 INSTANTIATE_TEST_CASE_P(UserMedia,
707 WebrtcUserMediaBrowserTest,
708 testing::ValuesIn(kAllUserMediaSizes));
709
710 // This test calls getUserMedia and checks for aspect ratio behavior.
711 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, TestGetUserMediaAspectRatio) {
712 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
713
714 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
715
716 std::string constraints_4_3 = GenerateGetUserMediaCall(
717 kGetUserMediaAndAnalyseAndStop, 640, 640, 480, 480, 30, 30);
718 std::string constraints_16_9 = GenerateGetUserMediaCall(
719 kGetUserMediaAndAnalyseAndStop, 640, 640, 360, 360, 30, 30);
720
721 // TODO(mcasas): add more aspect ratios, in particular 16:10 crbug.com/275594.
722
723 NavigateToURL(shell(), url);
724 ASSERT_TRUE(ExecuteJavascript(constraints_4_3));
725 ExpectTitle("4:3 letterbox");
726
727 NavigateToURL(shell(), url);
728 ASSERT_TRUE(ExecuteJavascript(constraints_16_9));
729 ExpectTitle("16:9 letterbox");
730 }
731
732 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, AddTwoMediaStreamsToOnePC) {
733 MakeTypicalPeerConnectionCall("addTwoMediaStreamsToOneConnection();"); 244 MakeTypicalPeerConnectionCall("addTwoMediaStreamsToOneConnection();");
734 } 245 }
735 246
736 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, 247 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
737 EstablishAudioVideoCallAndMeasureOutputLevel) { 248 EstablishAudioVideoCallAndMeasureOutputLevel) {
738 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { 249 if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
739 // Bots with no output devices will force the audio code into a different 250 // Bots with no output devices will force the audio code into a different
740 // path where it doesn't manage to set either the low or high latency path. 251 // path where it doesn't manage to set either the low or high latency path.
741 // This test will compute useless values in that case, so skip running on 252 // This test will compute useless values in that case, so skip running on
742 // such bots (see crbug.com/326338). 253 // such bots (see crbug.com/326338).
743 LOG(INFO) << "Missing output devices: skipping test..."; 254 LOG(INFO) << "Missing output devices: skipping test...";
744 return; 255 return;
745 } 256 }
746 257
747 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( 258 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
748 switches::kUseFakeDeviceForMediaStream)) 259 switches::kUseFakeDeviceForMediaStream))
749 << "Must run with fake devices since the test will explicitly look " 260 << "Must run with fake devices since the test will explicitly look "
750 << "for the fake device signal."; 261 << "for the fake device signal.";
751 262
752 MakeTypicalPeerConnectionCall("callAndEnsureAudioIsPlaying();"); 263 MakeTypicalPeerConnectionCall("callAndEnsureAudioIsPlaying();");
753 } 264 }
754 265
755 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, 266 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
756 EstablishAudioVideoCallAndVerifyMutingWorks) { 267 EstablishAudioVideoCallAndVerifyMutingWorks) {
757 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { 268 if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
758 // Bots with no output devices will force the audio code into a different 269 // Bots with no output devices will force the audio code into a different
759 // path where it doesn't manage to set either the low or high latency path. 270 // path where it doesn't manage to set either the low or high latency path.
760 // This test will compute useless values in that case, so skip running on 271 // This test will compute useless values in that case, so skip running on
761 // such bots (see crbug.com/326338). 272 // such bots (see crbug.com/326338).
762 LOG(INFO) << "Missing output devices: skipping test..."; 273 LOG(INFO) << "Missing output devices: skipping test...";
763 return; 274 return;
764 } 275 }
765 276
766 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( 277 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
767 switches::kUseFakeDeviceForMediaStream)) 278 switches::kUseFakeDeviceForMediaStream))
768 << "Must run with fake devices since the test will explicitly look " 279 << "Must run with fake devices since the test will explicitly look "
769 << "for the fake device signal."; 280 << "for the fake device signal.";
770 281
771 MakeTypicalPeerConnectionCall("callAndEnsureAudioMutingWorks();"); 282 MakeTypicalPeerConnectionCall("callAndEnsureAudioMutingWorks();");
772 } 283 }
773 284
774 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, CallAndVerifyVideoMutingWorks) { 285 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, CallAndVerifyVideoMutingWorks) {
775 MakeTypicalPeerConnectionCall("callAndEnsureVideoMutingWorks();"); 286 MakeTypicalPeerConnectionCall("callAndEnsureVideoMutingWorks();");
776 } 287 }
777 288
778 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(AR CH_CPU_ARM_FAMILY)) 289 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(AR CH_CPU_ARM_FAMILY))
779 // Timing out on ARM linux bot: http://crbug.com/238490 290 // Timing out on ARM linux bot: http://crbug.com/238490
780 // Failing on Windows: http://crbug.com/331035 291 // Failing on Windows: http://crbug.com/331035
781 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump 292 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
782 #else 293 #else
783 #define MAYBE_CallWithAecDump CallWithAecDump 294 #define MAYBE_CallWithAecDump CallWithAecDump
784 #endif 295 #endif
785 296
786 // This tests will make a complete PeerConnection-based call, verify that 297 // This tests will make a complete PeerConnection-based call, verify that
787 // video is playing for the call, and verify that a non-empty AEC dump file 298 // video is playing for the call, and verify that a non-empty AEC dump file
788 // exists. The AEC dump is enabled through webrtc-internals, in contrast to 299 // exists. The AEC dump is enabled through webrtc-internals, in contrast to
789 // using a command line flag (tested in webrtc_aecdump_browsertest.cc). The HTML 300 // using a command line flag (tested in webrtc_aecdump_browsertest.cc). The HTML
790 // and Javascript is bypassed since it would trigger a file picker dialog. 301 // and Javascript is bypassed since it would trigger a file picker dialog.
791 // Instead, the dialog callback FileSelected() is invoked directly. In fact, 302 // Instead, the dialog callback FileSelected() is invoked directly. In fact,
792 // there's never a webrtc-internals page opened at all since that's not needed. 303 // there's never a webrtc-internals page opened at all since that's not needed.
793 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithAecDump) { 304 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest, MAYBE_CallWithAecDump) {
794 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 305 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
795 306
796 // We must navigate somewhere first so that the render process is created. 307 // We must navigate somewhere first so that the render process is created.
797 NavigateToURL(shell(), GURL("")); 308 NavigateToURL(shell(), GURL(""));
798 309
799 base::FilePath dump_file; 310 base::FilePath dump_file;
800 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); 311 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
801 312
802 // This fakes the behavior of another open tab with webrtc-internals, and 313 // This fakes the behavior of another open tab with webrtc-internals, and
803 // enabling AEC dump in that tab. 314 // enabling AEC dump in that tab.
(...skipping 13 matching lines...) Expand all
817 328
818 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 329 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
819 // Timing out on ARM linux bot: http://crbug.com/238490 330 // Timing out on ARM linux bot: http://crbug.com/238490
820 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled ThenDisabled 331 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled ThenDisabled
821 #else 332 #else
822 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab led 333 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab led
823 #endif 334 #endif
824 335
825 // As above, but enable and disable dump before starting a call. The file should 336 // As above, but enable and disable dump before starting a call. The file should
826 // be created, but should be empty. 337 // be created, but should be empty.
827 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, 338 IN_PROC_BROWSER_TEST_F(WebRtcBrowserTest,
828 MAYBE_CallWithAecDumpEnabledThenDisabled) { 339 MAYBE_CallWithAecDumpEnabledThenDisabled) {
829 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 340 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
830 341
831 // We must navigate somewhere first so that the render process is created. 342 // We must navigate somewhere first so that the render process is created.
832 NavigateToURL(shell(), GURL("")); 343 NavigateToURL(shell(), GURL(""));
833 344
834 base::FilePath dump_file; 345 base::FilePath dump_file;
835 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); 346 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
836 347
837 // This fakes the behavior of another open tab with webrtc-internals, and 348 // This fakes the behavior of another open tab with webrtc-internals, and
838 // enabling AEC dump in that tab, then disabling it. 349 // enabling AEC dump in that tab, then disabling it.
839 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); 350 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
840 WebRTCInternals::GetInstance()->DisableAecDump(); 351 WebRTCInternals::GetInstance()->DisableAecDump();
841 352
842 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 353 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
843 NavigateToURL(shell(), url); 354 NavigateToURL(shell(), url);
844 ExecuteTestAndWaitForOk("call({video: true, audio: true});"); 355 ExecuteTestAndWaitForOk("call({video: true, audio: true});");
845 356
846 EXPECT_TRUE(base::PathExists(dump_file)); 357 EXPECT_TRUE(base::PathExists(dump_file));
847 int64 file_size = 0; 358 int64 file_size = 0;
848 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); 359 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
849 EXPECT_EQ(0, file_size); 360 EXPECT_EQ(0, file_size);
850 361
851 base::DeleteFile(dump_file, false); 362 base::DeleteFile(dump_file, false);
852 } 363 }
853 364
854
855 } // namespace content 365 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698