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

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

Issue 101063003: Add browser test for AEC dump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added another test. Code changes to avoid race. Allow enable dump after PCF creation. Created 7 years 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/debug/trace_event_impl.h" 6 #include "base/debug/trace_event_impl.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "content/browser/media/webrtc_internals.h"
11 #include "content/browser/web_contents/web_contents_impl.h" 12 #include "content/browser/web_contents/web_contents_impl.h"
12 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
13 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
14 #include "content/shell/browser/shell.h" 15 #include "content/shell/browser/shell.h"
15 #include "content/test/content_browser_test.h" 16 #include "content/test/content_browser_test.h"
16 #include "content/test/content_browser_test_utils.h" 17 #include "content/test/content_browser_test_utils.h"
17 #include "media/audio/audio_manager.h" 18 #include "media/audio/audio_manager.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h" 19 #include "net/test/embedded_test_server/embedded_test_server.h"
19 #include "testing/perf/perf_test.h" 20 #include "testing/perf/perf_test.h"
20 21
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 612
612 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 613 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
613 NavigateToURL(shell(), url); 614 NavigateToURL(shell(), url);
614 615
615 EXPECT_TRUE(ExecuteJavascript( 616 EXPECT_TRUE(ExecuteJavascript(
616 base::StringPrintf("callAndEnsureAudioMutingWorks(%s);", 617 base::StringPrintf("callAndEnsureAudioMutingWorks(%s);",
617 kForceIsac16K))); 618 kForceIsac16K)));
618 ExpectTitle("OK"); 619 ExpectTitle("OK");
619 } 620 }
620 621
622 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
623 // Timing out on ARM linux bot: http://crbug.com/238490
624 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
625 #else
626 #define MAYBE_CallWithAecDump CallWithAecDump
627 #endif
628
629 // This tests will make a complete PeerConnection-based call, verify that
630 // video is playing for the call, and verify that a non-empty AEC dump file
631 // exists. The AEC dump is enabled through webrtc-internals, in contrast to
632 // using a command line flag (tested in webrtc_aecdump_browsertest.cc). The HTML
633 // and Javascript is bypassed since it would trigger a file picker dialog.
634 // Instead, the dialog callback FileSelected() is invoked directly. In fact,
635 // there's never a webrtc-internals page opened at all since that's not needed.
636 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithAecDump) {
637 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
638
639 // We must navigate somewhere first so that the render process is created.
640 NavigateToURL(shell(), GURL(""));
641
642 base::FilePath dump_file;
643 ASSERT_TRUE(base::GetTempDir(&dump_file));
phoglund_chromium 2013/12/18 14:20:46 Again use CreateTemporaryFile here.
Henrik Grunell 2013/12/19 08:43:14 Done.
644 dump_file = dump_file.Append(
645 base::FilePath(FILE_PATH_LITERAL("audio.aecdump")));
646 ASSERT_TRUE(base::DeleteFile(dump_file, false));
647
648 // This fakes the behavior of another open tab with webrtc-internals, and
649 // enabling AEC dump in that tab.
650 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
651
652 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
653 NavigateToURL(shell(), url);
654
655 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
656 ExpectTitle("OK");
657
658 EXPECT_TRUE(base::PathExists(dump_file));
phoglund_chromium 2013/12/18 14:20:46 You may as well assert on all of these: further er
Henrik Grunell 2013/12/19 08:43:14 But that won't delete the file, which afaik is not
phoglund_chromium 2013/12/19 11:57:04 Hmm, yeah that's true. Like I said offline you sho
659 int64 file_size = 0;
660 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
661 EXPECT_GT(file_size, 0);
662
663 EXPECT_TRUE(base::DeleteFile(dump_file, false));
664 }
665
666 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
667 // Timing out on ARM linux bot: http://crbug.com/238490
668 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled ThenDisabled
669 #else
670 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab led
671 #endif
672
673 // As above, but enable and disable sump before starting a call. The file should
phoglund_chromium 2013/12/18 14:20:46 sump?
Henrik Grunell 2013/12/19 08:43:14 That's dump's evil twin. But I'll write a test for
phoglund_chromium 2013/12/19 11:57:04 hehe
674 // be created, but should be empty.
675 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
676 MAYBE_CallWithAecDumpEnabledThenDisabled) {
677 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
678
679 // We must navigate somewhere first so that the render process is created.
680 NavigateToURL(shell(), GURL(""));
681
682 base::FilePath dump_file;
683 ASSERT_TRUE(base::GetTempDir(&dump_file));
phoglund_chromium 2013/12/18 14:20:46 CreateTemporaryFile
Henrik Grunell 2013/12/19 08:43:14 Done.
684 dump_file = dump_file.Append(
685 base::FilePath(FILE_PATH_LITERAL("audio.aecdump")));
686 ASSERT_TRUE(base::DeleteFile(dump_file, false));
687
688 // This fakes the behavior of another open tab with webrtc-internals, and
689 // enabling AEC dump in that tab, then disabling it.
690 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
691 WebRTCInternals::GetInstance()->DisableAecDump();
692
693 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
694 NavigateToURL(shell(), url);
695
696 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
697 ExpectTitle("OK");
698
699 EXPECT_TRUE(base::PathExists(dump_file));
700 int64 file_size = 0;
701 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
702 EXPECT_EQ(0, file_size);
703
704 EXPECT_TRUE(base::DeleteFile(dump_file, false));
705 }
706
707
621 } // namespace content 708 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698