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
3 // found in the LICENSE file.
5 #include "base/command_line.h"
6 #include "base/file_util.h"
7 #include "base/process/process_handle.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h"
10 #include "base/threading/platform_thread.h"
11 #include "base/values.h"
12 #include "content/browser/media/webrtc_internals.h"
13 #include "content/browser/web_contents/web_contents_impl.h"
14 #include "content/public/common/content_switches.h"
15 #include "content/public/test/browser_test_utils.h"
16 #include "content/public/test/content_browser_test_utils.h"
17 #include "content/public/test/test_utils.h"
18 #include "content/shell/browser/shell.h"
19 #include "content/test/webrtc_content_browsertest_base.h"
20 #include "media/audio/audio_manager.h"
21 #include "media/base/media_switches.h"
22 #include "net/test/embedded_test_server/embedded_test_server.h"
25 #include "base/win/windows_version.h"
30 #if defined (OS_ANDROID) || defined(THREAD_SANITIZER)
31 // Just do the bare minimum of audio checking on Android and under TSAN since
32 // it's a bit sensitive to device performance.
33 const char kUseLenientAudioChecking
[] = "true";
35 const char kUseLenientAudioChecking
[] = "false";
38 const int kExpectedConsumerId
= 0;
40 // Get the ID for the render process host when there should only be one.
41 bool GetRenderProcessHostId(base::ProcessId
* id
) {
42 content::RenderProcessHost::iterator
it(
43 content::RenderProcessHost::AllHostsIterator());
44 *id
= base::GetProcId(it
.GetCurrentValue()->GetHandle());
45 EXPECT_NE(base::kNullProcessId
, *id
);
46 if (*id
== base::kNullProcessId
)
49 EXPECT_TRUE(it
.IsAtEnd());
57 class WebRtcBrowserTest
: public WebRtcContentBrowserTest
,
58 public testing::WithParamInterface
<bool> {
60 WebRtcBrowserTest() {}
61 virtual ~WebRtcBrowserTest() {}
63 virtual void SetUpCommandLine(CommandLine
* command_line
) OVERRIDE
{
64 WebRtcContentBrowserTest::SetUpCommandLine(command_line
);
66 bool enable_audio_track_processing
= GetParam();
67 if (!enable_audio_track_processing
)
68 command_line
->AppendSwitch(switches::kDisableAudioTrackProcessing
);
71 // Convenience function since most peerconnection-call.html tests just load
72 // the page, kick off some javascript and wait for the title to change to OK.
73 void MakeTypicalPeerConnectionCall(const std::string
& javascript
) {
74 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
76 GURL
url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
77 NavigateToURL(shell(), url
);
79 DisableOpusIfOnAndroid();
80 ExecuteJavascriptAndWaitForOk(javascript
);
83 // Convenience method for making calls that detect if audio os playing (which
84 // has some special prerequisites, such that there needs to be an audio output
85 // device on the executing machine).
86 void MakeAudioDetectingPeerConnectionCall(const std::string
& javascript
) {
87 if (!media::AudioManager::Get()->HasAudioOutputDevices()) {
88 // Bots with no output devices will force the audio code into a state
89 // where it doesn't manage to set either the low or high latency path.
90 // This test will compute useless values in that case, so skip running on
91 // such bots (see crbug.com/326338).
92 LOG(INFO
) << "Missing output devices: skipping test...";
96 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
97 switches::kUseFakeDeviceForMediaStream
))
98 << "Must run with fake devices since the test will explicitly look "
99 << "for the fake device signal.";
101 MakeTypicalPeerConnectionCall(javascript
);
104 void DisableOpusIfOnAndroid() {
105 #if defined(OS_ANDROID)
106 // Always force iSAC 16K on Android for now (Opus is broken).
107 EXPECT_EQ("isac-forced",
108 ExecuteJavascriptAndReturnResult("forceIsac16KInSdp();"));
113 static const bool kRunTestsWithFlag
[] = { false, true };
114 INSTANTIATE_TEST_CASE_P(WebRtcBrowserTests
,
116 testing::ValuesIn(kRunTestsWithFlag
));
118 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
119 // Timing out on ARM linux bot: http://crbug.com/238490
120 #define MAYBE_CanSetupDefaultVideoCall DISABLED_CanSetupDefaultVideoCall
122 #define MAYBE_CanSetupDefaultVideoCall CanSetupDefaultVideoCall
125 // These tests will make a complete PeerConnection-based call and verify that
126 // video is playing for the call.
127 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CanSetupDefaultVideoCall
) {
128 MakeTypicalPeerConnectionCall(
129 "callAndExpectResolution({video: true}, 640, 480);");
132 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, CanSetupVideoCallWith1To1AspecRatio
) {
133 const std::string javascript
=
134 "callAndExpectResolution({video: {mandatory: {minWidth: 320,"
135 " maxWidth: 320, minHeight: 320, maxHeight: 320}}}, 320, 320);";
136 MakeTypicalPeerConnectionCall(javascript
);
139 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
140 CanSetupVideoCallWith16To9AspecRatio
) {
141 const std::string javascript
=
142 "callAndExpectResolution({video: {mandatory: {minWidth: 640,"
143 " maxWidth: 640, minAspectRatio: 1.777}}}, 640, 360);";
144 MakeTypicalPeerConnectionCall(javascript
);
147 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
148 CanSetupVideoCallWith4To3AspecRatio
) {
149 const std::string javascript
=
150 "callAndExpectResolution({video: {mandatory: {minWidth: 960,"
151 "maxAspectRatio: 1.333}}}, 960, 720);";
152 MakeTypicalPeerConnectionCall(javascript
);
155 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
156 // Timing out on ARM linux, see http://crbug.com/240376
157 #define MAYBE_CanSetupAudioAndVideoCall DISABLED_CanSetupAudioAndVideoCall
159 #define MAYBE_CanSetupAudioAndVideoCall CanSetupAudioAndVideoCall
162 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CanSetupAudioAndVideoCall
) {
163 MakeTypicalPeerConnectionCall("call({video: true, audio: true});");
166 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MANUAL_CanSetupCallAndSendDtmf
) {
167 MakeTypicalPeerConnectionCall("callAndSendDtmf(\'123,abc\');");
170 // TODO(phoglund): this test fails because the peer connection state will be
171 // stable in the second negotiation round rather than have-local-offer.
172 // http://crbug.com/293125.
173 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
174 DISABLED_CanMakeEmptyCallThenAddStreamsAndRenegotiate
) {
175 const char* kJavascript
=
176 "callEmptyThenAddOneStreamAndRenegotiate({video: true, audio: true});";
177 MakeTypicalPeerConnectionCall(kJavascript
);
180 // Below 2 test will make a complete PeerConnection-based call between pc1 and
181 // pc2, and then use the remote stream to setup a call between pc3 and pc4, and
182 // then verify that video is received on pc3 and pc4.
183 // The stream sent from pc3 to pc4 is the stream received on pc1.
184 // The stream sent from pc4 to pc3 is cloned from stream the stream received
186 // Flaky on win xp. http://crbug.com/304775
188 #define MAYBE_CanForwardRemoteStream DISABLED_CanForwardRemoteStream
189 #define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p
191 #define MAYBE_CanForwardRemoteStream CanForwardRemoteStream
192 // Flaky on TSAN v2. http://crbug.com/373637
193 #if defined(THREAD_SANITIZER)
194 #define MAYBE_CanForwardRemoteStream720p DISABLED_CanForwardRemoteStream720p
196 #define MAYBE_CanForwardRemoteStream720p CanForwardRemoteStream720p
199 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CanForwardRemoteStream
) {
200 #if defined (OS_ANDROID)
201 // This test fails on Nexus 5 devices.
202 // TODO(henrika): see http://crbug.com/362437 and http://crbug.com/359389
204 CommandLine::ForCurrentProcess()->AppendSwitch(
205 switches::kDisableWebRtcHWDecoding
);
207 MakeTypicalPeerConnectionCall(
208 "callAndForwardRemoteStream({video: true, audio: false});");
211 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CanForwardRemoteStream720p
) {
212 #if defined (OS_ANDROID)
213 // This test fails on Nexus 5 devices.
214 // TODO(henrika): see http://crbug.com/362437 and http://crbug.com/359389
216 CommandLine::ForCurrentProcess()->AppendSwitch(
217 switches::kDisableWebRtcHWDecoding
);
219 const std::string javascript
= GenerateGetUserMediaCall(
220 "callAndForwardRemoteStream", 1280, 1280, 720, 720, 10, 30);
221 MakeTypicalPeerConnectionCall(javascript
);
224 // This test will make a complete PeerConnection-based call but remove the
225 // MSID and bundle attribute from the initial offer to verify that
226 // video is playing for the call even if the initiating client don't support
227 // MSID. http://tools.ietf.org/html/draft-alvestrand-rtcweb-msid-02
228 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
229 // Timing out on ARM linux, see http://crbug.com/240373
230 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
231 DISABLED_CanSetupAudioAndVideoCallWithoutMsidAndBundle
233 #define MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle\
234 CanSetupAudioAndVideoCallWithoutMsidAndBundle
236 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
237 MAYBE_CanSetupAudioAndVideoCallWithoutMsidAndBundle
) {
238 MakeTypicalPeerConnectionCall("callWithoutMsidAndBundle();");
241 // This test will modify the SDP offer to an unsupported codec, which should
242 // cause SetLocalDescription to fail.
243 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, NegotiateUnsupportedVideoCodec
) {
244 MakeTypicalPeerConnectionCall("negotiateUnsupportedVideoCodec();");
247 // This test will modify the SDP offer to use no encryption, which should
248 // cause SetLocalDescription to fail.
249 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, NegotiateNonCryptoCall
) {
250 MakeTypicalPeerConnectionCall("negotiateNonCryptoCall();");
253 // This test can negotiate an SDP offer that includes a b=AS:xx to control
254 // the bandwidth for audio and video
255 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, NegotiateOfferWithBLine
) {
256 MakeTypicalPeerConnectionCall("negotiateOfferWithBLine();");
259 // This test will make a complete PeerConnection-based call using legacy SDP
260 // settings: GIce, external SDES, and no BUNDLE.
261 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
262 // Timing out on ARM linux, see http://crbug.com/240373
263 #define MAYBE_CanSetupLegacyCall DISABLED_CanSetupLegacyCall
265 #define MAYBE_CanSetupLegacyCall CanSetupLegacyCall
268 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CanSetupLegacyCall
) {
269 MakeTypicalPeerConnectionCall("callWithLegacySdp();");
272 // This test will make a PeerConnection-based call and test an unreliable text
274 // TODO(mallinath) - Remove this test after rtp based data channel is disabled.
275 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, CallWithDataOnly
) {
276 MakeTypicalPeerConnectionCall("callWithDataOnly();");
279 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, CallWithSctpDataOnly
) {
280 MakeTypicalPeerConnectionCall("callWithSctpDataOnly();");
283 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
284 // Timing out on ARM linux bot: http://crbug.com/238490
285 #define MAYBE_CallWithDataAndMedia DISABLED_CallWithDataAndMedia
287 #define MAYBE_CallWithDataAndMedia CallWithDataAndMedia
290 // This test will make a PeerConnection-based call and test an unreliable text
291 // dataChannel and audio and video tracks.
292 // TODO(mallinath) - Remove this test after rtp based data channel is disabled.
293 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, DISABLED_CallWithDataAndMedia
) {
294 MakeTypicalPeerConnectionCall("callWithDataAndMedia();");
298 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
299 // Timing out on ARM linux bot: http://crbug.com/238490
300 #define MAYBE_CallWithSctpDataAndMedia DISABLED_CallWithSctpDataAndMedia
302 #define MAYBE_CallWithSctpDataAndMedia CallWithSctpDataAndMedia
305 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
306 MAYBE_CallWithSctpDataAndMedia
) {
307 MakeTypicalPeerConnectionCall("callWithSctpDataAndMedia();");
310 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
311 // Timing out on ARM linux bot: http://crbug.com/238490
312 #define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia
314 // Temporarily disable the test on all platforms. http://crbug.com/293252
315 #define MAYBE_CallWithDataAndLaterAddMedia DISABLED_CallWithDataAndLaterAddMedia
318 // This test will make a PeerConnection-based call and test an unreliable text
319 // dataChannel and later add an audio and video track.
320 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CallWithDataAndLaterAddMedia
) {
321 MakeTypicalPeerConnectionCall("callWithDataAndLaterAddMedia();");
324 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
325 // Timing out on ARM linux bot: http://crbug.com/238490
326 #define MAYBE_CallWithNewVideoMediaStream DISABLED_CallWithNewVideoMediaStream
328 #define MAYBE_CallWithNewVideoMediaStream CallWithNewVideoMediaStream
331 // This test will make a PeerConnection-based call and send a new Video
332 // MediaStream that has been created based on a MediaStream created with
334 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CallWithNewVideoMediaStream
) {
335 MakeTypicalPeerConnectionCall("callWithNewVideoMediaStream();");
338 // This test will make a PeerConnection-based call and send a new Video
339 // MediaStream that has been created based on a MediaStream created with
340 // getUserMedia. When video is flowing, the VideoTrack is removed and an
341 // AudioTrack is added instead.
342 // TODO(phoglund): This test is manual since not all buildbots has an audio
344 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MANUAL_CallAndModifyStream
) {
345 MakeTypicalPeerConnectionCall(
346 "callWithNewVideoMediaStreamLaterSwitchToAudio();");
349 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, AddTwoMediaStreamsToOnePC
) {
350 MakeTypicalPeerConnectionCall("addTwoMediaStreamsToOneConnection();");
353 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
354 EstablishAudioVideoCallAndEnsureAudioIsPlaying
) {
355 MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
356 "callAndEnsureAudioIsPlaying(%s, {audio:true, video:true});",
357 kUseLenientAudioChecking
));
360 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
361 EstablishAudioOnlyCallAndEnsureAudioIsPlaying
) {
362 MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
363 "callAndEnsureAudioIsPlaying(%s, {audio:true});",
364 kUseLenientAudioChecking
));
367 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
368 EstablishAudioVideoCallAndVerifyMutingWorks
) {
369 MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
370 "callAndEnsureAudioTrackMutingWorks(%s);", kUseLenientAudioChecking
));
373 // Flaky on TSAN v2: http://crbug.com/373637
374 #if defined(THREAD_SANITIZER)
375 #define MAYBE_EstablishAudioVideoCallAndVerifyUnmutingWorks\
376 DISABLED_EstablishAudioVideoCallAndVerifyUnmutingWorks
378 #define MAYBE_EstablishAudioVideoCallAndVerifyUnmutingWorks\
379 EstablishAudioVideoCallAndVerifyUnmutingWorks
381 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
382 MAYBE_EstablishAudioVideoCallAndVerifyUnmutingWorks
) {
383 MakeAudioDetectingPeerConnectionCall(base::StringPrintf(
384 "callAndEnsureAudioTrackUnmutingWorks(%s);", kUseLenientAudioChecking
));
387 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, CallAndVerifyVideoMutingWorks
) {
388 MakeTypicalPeerConnectionCall("callAndEnsureVideoTrackMutingWorks();");
392 #define IntToStringType base::IntToString16
394 #define IntToStringType base::IntToString
397 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
398 // Timing out on ARM linux bot: http://crbug.com/238490
399 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
401 #define MAYBE_CallWithAecDump CallWithAecDump
404 // This tests will make a complete PeerConnection-based call, verify that
405 // video is playing for the call, and verify that a non-empty AEC dump file
406 // exists. The AEC dump is enabled through webrtc-internals. The HTML and
407 // Javascript is bypassed since it would trigger a file picker dialog. Instead,
408 // the dialog callback FileSelected() is invoked directly. In fact, there's
409 // never a webrtc-internals page opened at all since that's not needed.
410 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_CallWithAecDump
) {
411 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
413 // We must navigate somewhere first so that the render process is created.
414 NavigateToURL(shell(), GURL(""));
416 base::FilePath dump_file
;
417 ASSERT_TRUE(CreateTemporaryFile(&dump_file
));
418 base::DeleteFile(dump_file
, false);
420 // This fakes the behavior of another open tab with webrtc-internals, and
421 // enabling AEC dump in that tab.
422 WebRTCInternals::GetInstance()->FileSelected(dump_file
, -1, NULL
);
424 GURL
url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
425 NavigateToURL(shell(), url
);
426 DisableOpusIfOnAndroid();
427 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
429 EXPECT_FALSE(base::PathExists(dump_file
));
431 // Add file extensions that we expect to be added. The dump name will be
432 // <temporary path>.<render process id>.<consumer id>, for example
433 // "/tmp/.com.google.Chrome.Z6UC3P.12345.0".
434 base::ProcessId render_process_id
= base::kNullProcessId
;
435 EXPECT_TRUE(GetRenderProcessHostId(&render_process_id
));
436 dump_file
= dump_file
.AddExtension(IntToStringType(render_process_id
))
437 .AddExtension(IntToStringType(kExpectedConsumerId
));
439 EXPECT_TRUE(base::PathExists(dump_file
));
441 EXPECT_TRUE(base::GetFileSize(dump_file
, &file_size
));
442 EXPECT_GT(file_size
, 0);
444 base::DeleteFile(dump_file
, false);
447 // TODO(grunell): Add test for multiple dumps when re-use of
448 // MediaStreamAudioProcessor in AudioCapturer has been removed.
450 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
451 // Timing out on ARM linux bot: http://crbug.com/238490
452 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabledThenDisabled
454 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisabled
457 // As above, but enable and disable dump before starting a call. The file should
458 // be created, but should be empty.
459 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
,
460 MAYBE_CallWithAecDumpEnabledThenDisabled
) {
461 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
463 // We must navigate somewhere first so that the render process is created.
464 NavigateToURL(shell(), GURL(""));
466 base::FilePath dump_file
;
467 ASSERT_TRUE(CreateTemporaryFile(&dump_file
));
468 base::DeleteFile(dump_file
, false);
470 // This fakes the behavior of another open tab with webrtc-internals, and
471 // enabling AEC dump in that tab, then disabling it.
472 WebRTCInternals::GetInstance()->FileSelected(dump_file
, -1, NULL
);
473 WebRTCInternals::GetInstance()->DisableAecDump();
475 GURL
url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
476 NavigateToURL(shell(), url
);
477 DisableOpusIfOnAndroid();
478 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
480 // Add file extensions that we expect to be added.
481 base::ProcessId render_process_id
= base::kNullProcessId
;
482 EXPECT_TRUE(GetRenderProcessHostId(&render_process_id
));
483 dump_file
= dump_file
.AddExtension(IntToStringType(render_process_id
))
484 .AddExtension(IntToStringType(kExpectedConsumerId
));
486 EXPECT_FALSE(base::PathExists(dump_file
));
488 base::DeleteFile(dump_file
, false);
491 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
492 // Timing out on ARM linux bot: http://crbug.com/238490
493 #define MAYBE_TwoCallsWithAecDump DISABLED_TwoCallsWithAecDump
495 #define MAYBE_TwoCallsWithAecDump TwoCallsWithAecDump
498 IN_PROC_BROWSER_TEST_P(WebRtcBrowserTest
, MAYBE_TwoCallsWithAecDump
) {
499 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
501 // We must navigate somewhere first so that the render process is created.
502 NavigateToURL(shell(), GURL(""));
504 // Create a second window.
505 Shell
* shell2
= CreateBrowser();
506 NavigateToURL(shell2
, GURL(""));
508 base::FilePath dump_file
;
509 ASSERT_TRUE(CreateTemporaryFile(&dump_file
));
510 base::DeleteFile(dump_file
, false);
512 // This fakes the behavior of another open tab with webrtc-internals, and
513 // enabling AEC dump in that tab.
514 WebRTCInternals::GetInstance()->FileSelected(dump_file
, -1, NULL
);
516 GURL
url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
518 NavigateToURL(shell(), url
);
519 NavigateToURL(shell2
, url
);
520 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
522 EXPECT_TRUE(ExecuteScriptAndExtractString(
523 shell2
->web_contents(),
524 "call({video: true, audio: true});",
526 ASSERT_STREQ("OK", result
.c_str());
528 EXPECT_FALSE(base::PathExists(dump_file
));
530 RenderProcessHost::iterator it
=
531 content::RenderProcessHost::AllHostsIterator();
532 for (; !it
.IsAtEnd(); it
.Advance()) {
533 base::ProcessId render_process_id
=
534 base::GetProcId(it
.GetCurrentValue()->GetHandle());
535 EXPECT_NE(base::kNullProcessId
, render_process_id
);
537 // Add file extensions that we expect to be added.
538 base::FilePath unique_dump_file
=
539 dump_file
.AddExtension(IntToStringType(render_process_id
))
540 .AddExtension(IntToStringType(kExpectedConsumerId
));
542 EXPECT_TRUE(base::PathExists(unique_dump_file
));
544 EXPECT_TRUE(base::GetFileSize(unique_dump_file
, &file_size
));
545 EXPECT_GT(file_size
, 0);
547 base::DeleteFile(unique_dump_file
, false);
551 } // namespace content