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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/webrtc_browsertest.cc
diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc
index 47847a7d53bac2b7b1776d4602123880539f273f..9e68826542ea52d69e7ce4eb9860058352432a23 100644
--- a/content/browser/media/webrtc_browsertest.cc
+++ b/content/browser/media/webrtc_browsertest.cc
@@ -8,6 +8,7 @@
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
+#include "content/browser/media/webrtc_internals.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
@@ -618,4 +619,90 @@ IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
ExpectTitle("OK");
}
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
+// Timing out on ARM linux bot: http://crbug.com/238490
+#define MAYBE_CallWithAecDump DISABLED_CallWithAecDump
+#else
+#define MAYBE_CallWithAecDump CallWithAecDump
+#endif
+
+// This tests will make a complete PeerConnection-based call, verify that
+// video is playing for the call, and verify that a non-empty AEC dump file
+// exists. The AEC dump is enabled through webrtc-internals, in contrast to
+// using a command line flag (tested in webrtc_aecdump_browsertest.cc). The HTML
+// and Javascript is bypassed since it would trigger a file picker dialog.
+// Instead, the dialog callback FileSelected() is invoked directly. In fact,
+// there's never a webrtc-internals page opened at all since that's not needed.
+IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithAecDump) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ // We must navigate somewhere first so that the render process is created.
+ NavigateToURL(shell(), GURL(""));
+
+ base::FilePath dump_file;
+ 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.
+ dump_file = dump_file.Append(
+ base::FilePath(FILE_PATH_LITERAL("audio.aecdump")));
+ ASSERT_TRUE(base::DeleteFile(dump_file, false));
+
+ // This fakes the behavior of another open tab with webrtc-internals, and
+ // enabling AEC dump in that tab.
+ WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
+
+ GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
+ NavigateToURL(shell(), url);
+
+ EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
+ ExpectTitle("OK");
+
+ 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
+ int64 file_size = 0;
+ EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
+ EXPECT_GT(file_size, 0);
+
+ EXPECT_TRUE(base::DeleteFile(dump_file, false));
+}
+
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
+// Timing out on ARM linux bot: http://crbug.com/238490
+#define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabledThenDisabled
+#else
+#define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisabled
+#endif
+
+// 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
+// be created, but should be empty.
+IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest,
+ MAYBE_CallWithAecDumpEnabledThenDisabled) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ // We must navigate somewhere first so that the render process is created.
+ NavigateToURL(shell(), GURL(""));
+
+ base::FilePath dump_file;
+ ASSERT_TRUE(base::GetTempDir(&dump_file));
phoglund_chromium 2013/12/18 14:20:46 CreateTemporaryFile
Henrik Grunell 2013/12/19 08:43:14 Done.
+ dump_file = dump_file.Append(
+ base::FilePath(FILE_PATH_LITERAL("audio.aecdump")));
+ ASSERT_TRUE(base::DeleteFile(dump_file, false));
+
+ // This fakes the behavior of another open tab with webrtc-internals, and
+ // enabling AEC dump in that tab, then disabling it.
+ WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
+ WebRTCInternals::GetInstance()->DisableAecDump();
+
+ GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
+ NavigateToURL(shell(), url);
+
+ EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});"));
+ ExpectTitle("OK");
+
+ EXPECT_TRUE(base::PathExists(dump_file));
+ int64 file_size = 0;
+ EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
+ EXPECT_EQ(0, file_size);
+
+ EXPECT_TRUE(base::DeleteFile(dump_file, false));
+}
+
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698