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

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: Don't check return value of DeleteFile. 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(CreateTemporaryFile(&dump_file));
644
645 // This fakes the behavior of another open tab with webrtc-internals, and
646 // enabling AEC dump in that tab.
647 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
648
649 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
650 NavigateToURL(shell(), url);
651
652 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
653 ExpectTitle("OK");
654
655 EXPECT_TRUE(base::PathExists(dump_file));
656 int64 file_size = 0;
657 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
658 EXPECT_GT(file_size, 0);
659
660 base::DeleteFile(dump_file, false);
661 }
662
663 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
664 // Timing out on ARM linux bot: http://crbug.com/238490
665 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled ThenDisabled
666 #else
667 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab led
668 #endif
669
670 // As above, but enable and disable dump before starting a call. The file should
671 // be created, but should be empty.
672 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
673 MAYBE_CallWithAecDumpEnabledThenDisabled) {
674 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
675
676 // We must navigate somewhere first so that the render process is created.
677 NavigateToURL(shell(), GURL(""));
678
679 base::FilePath dump_file;
680 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
681
682 // This fakes the behavior of another open tab with webrtc-internals, and
683 // enabling AEC dump in that tab, then disabling it.
684 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
685 WebRTCInternals::GetInstance()->DisableAecDump();
686
687 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
688 NavigateToURL(shell(), url);
689
690 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
691 ExpectTitle("OK");
692
693 EXPECT_TRUE(base::PathExists(dump_file));
694 int64 file_size = 0;
695 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
696 EXPECT_EQ(0, file_size);
697
698 base::DeleteFile(dump_file, false);
699 }
700
701
621 } // namespace content 702 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698