OLD | NEW |
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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 | 807 |
807 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); | 808 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); |
808 NavigateToURL(shell(), url); | 809 NavigateToURL(shell(), url); |
809 | 810 |
810 EXPECT_TRUE(ExecuteJavascript( | 811 EXPECT_TRUE(ExecuteJavascript( |
811 base::StringPrintf("callAndEnsureAudioMutingWorks(%s);", | 812 base::StringPrintf("callAndEnsureAudioMutingWorks(%s);", |
812 kForceIsac16K))); | 813 kForceIsac16K))); |
813 ExpectTitle("OK"); | 814 ExpectTitle("OK"); |
814 } | 815 } |
815 | 816 |
| 817 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 818 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 819 #define MAYBE_CallWithAecDump DISABLED_CallWithAecDump |
| 820 #else |
| 821 #define MAYBE_CallWithAecDump CallWithAecDump |
| 822 #endif |
| 823 |
| 824 // This tests will make a complete PeerConnection-based call, verify that |
| 825 // video is playing for the call, and verify that a non-empty AEC dump file |
| 826 // exists. The AEC dump is enabled through webrtc-internals, in contrast to |
| 827 // using a command line flag (tested in webrtc_aecdump_browsertest.cc). The HTML |
| 828 // and Javascript is bypassed since it would trigger a file picker dialog. |
| 829 // Instead, the dialog callback FileSelected() is invoked directly. In fact, |
| 830 // there's never a webrtc-internals page opened at all since that's not needed. |
| 831 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, MAYBE_CallWithAecDump) { |
| 832 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 833 |
| 834 // We must navigate somewhere first so that the render process is created. |
| 835 NavigateToURL(shell(), GURL("")); |
| 836 |
| 837 base::FilePath dump_file; |
| 838 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); |
| 839 |
| 840 // This fakes the behavior of another open tab with webrtc-internals, and |
| 841 // enabling AEC dump in that tab. |
| 842 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); |
| 843 |
| 844 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); |
| 845 NavigateToURL(shell(), url); |
| 846 |
| 847 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); |
| 848 ExpectTitle("OK"); |
| 849 |
| 850 EXPECT_TRUE(base::PathExists(dump_file)); |
| 851 int64 file_size = 0; |
| 852 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); |
| 853 EXPECT_GT(file_size, 0); |
| 854 |
| 855 base::DeleteFile(dump_file, false); |
| 856 } |
| 857 |
| 858 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) |
| 859 // Timing out on ARM linux bot: http://crbug.com/238490 |
| 860 #define MAYBE_CallWithAecDumpEnabledThenDisabled DISABLED_CallWithAecDumpEnabled
ThenDisabled |
| 861 #else |
| 862 #define MAYBE_CallWithAecDumpEnabledThenDisabled CallWithAecDumpEnabledThenDisab
led |
| 863 #endif |
| 864 |
| 865 // As above, but enable and disable dump before starting a call. The file should |
| 866 // be created, but should be empty. |
| 867 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 868 MAYBE_CallWithAecDumpEnabledThenDisabled) { |
| 869 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 870 |
| 871 // We must navigate somewhere first so that the render process is created. |
| 872 NavigateToURL(shell(), GURL("")); |
| 873 |
| 874 base::FilePath dump_file; |
| 875 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); |
| 876 |
| 877 // This fakes the behavior of another open tab with webrtc-internals, and |
| 878 // enabling AEC dump in that tab, then disabling it. |
| 879 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); |
| 880 WebRTCInternals::GetInstance()->DisableAecDump(); |
| 881 |
| 882 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); |
| 883 NavigateToURL(shell(), url); |
| 884 |
| 885 EXPECT_TRUE(ExecuteJavascript("call({video: true, audio: true});")); |
| 886 ExpectTitle("OK"); |
| 887 |
| 888 EXPECT_TRUE(base::PathExists(dump_file)); |
| 889 int64 file_size = 0; |
| 890 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); |
| 891 EXPECT_EQ(0, file_size); |
| 892 |
| 893 base::DeleteFile(dump_file, false); |
| 894 } |
| 895 |
| 896 |
816 } // namespace content | 897 } // namespace content |
OLD | NEW |