| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <ctime> | 7 #include <ctime> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 30 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
| 32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
| 33 #include "content/public/test/browser_test_utils.h" | 33 #include "content/public/test/browser_test_utils.h" |
| 34 #include "media/base/audio_parameters.h" | 34 #include "media/base/audio_parameters.h" |
| 35 #include "media/base/media_switches.h" | 35 #include "media/base/media_switches.h" |
| 36 #include "net/test/embedded_test_server/embedded_test_server.h" | 36 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 37 #include "testing/perf/perf_test.h" | 37 #include "testing/perf/perf_test.h" |
| 38 | 38 |
| 39 #if defined(OS_MACOSX) |
| 40 #include "base/threading/thread_restrictions.h" |
| 41 #endif // defined(OS_MACOSX) |
| 42 |
| 39 namespace { | 43 namespace { |
| 40 | 44 |
| 41 static const base::FilePath::CharType kReferenceFile[] = | 45 static const base::FilePath::CharType kReferenceFile[] = |
| 42 FILE_PATH_LITERAL("speech_44kHz_16bit_stereo.wav"); | 46 FILE_PATH_LITERAL("speech_44kHz_16bit_stereo.wav"); |
| 43 | 47 |
| 44 // The javascript will load the reference file relative to its location, | 48 // The javascript will load the reference file relative to its location, |
| 45 // which is in /webrtc on the web server. The files we are looking for are in | 49 // which is in /webrtc on the web server. The files we are looking for are in |
| 46 // webrtc/resources in the chrome/test/data folder. | 50 // webrtc/resources in the chrome/test/data folder. |
| 47 static const char kReferenceFileRelativeUrl[] = | 51 static const char kReferenceFileRelativeUrl[] = |
| 48 "resources/speech_44kHz_16bit_stereo.wav"; | 52 "resources/speech_44kHz_16bit_stereo.wav"; |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall( | 678 ASSERT_NO_FATAL_FAILURE(SetupAndRecordAudioCall( |
| 675 reference_file, recording, constraints, | 679 reference_file, recording, constraints, |
| 676 base::TimeDelta::FromSeconds(30))); | 680 base::TimeDelta::FromSeconds(30))); |
| 677 | 681 |
| 678 ComputeAndPrintPesqResults(reference_file, recording, perf_modifier); | 682 ComputeAndPrintPesqResults(reference_file, recording, perf_modifier); |
| 679 DeleteFileUnlessTestFailed(recording, false); | 683 DeleteFileUnlessTestFailed(recording, false); |
| 680 } | 684 } |
| 681 | 685 |
| 682 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, | 686 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, |
| 683 MANUAL_TestCallQualityWithAudioFromFakeDevice) { | 687 MANUAL_TestCallQualityWithAudioFromFakeDevice) { |
| 688 // crbug.com/684680 |
| 689 #if defined(OS_MACOSX) |
| 690 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 691 #endif // defined(OS_MACOSX) |
| 684 TestWithFakeDeviceGetUserMedia(kAudioOnlyCallConstraints, "_getusermedia"); | 692 TestWithFakeDeviceGetUserMedia(kAudioOnlyCallConstraints, "_getusermedia"); |
| 685 } | 693 } |
| 686 | 694 |
| 687 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, | 695 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, |
| 688 MANUAL_TestCallQualityWithAudioFromWebAudio) { | 696 MANUAL_TestCallQualityWithAudioFromWebAudio) { |
| 697 // crbug.com/684680 |
| 698 #if defined(OS_MACOSX) |
| 699 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 700 #endif // defined(OS_MACOSX) |
| 689 if (OnWin8()) { | 701 if (OnWin8()) { |
| 690 // http://crbug.com/379798. | 702 // http://crbug.com/379798. |
| 691 LOG(ERROR) << "This test is not implemented for Windows XP/Win8."; | 703 LOG(ERROR) << "This test is not implemented for Windows XP/Win8."; |
| 692 return; | 704 return; |
| 693 } | 705 } |
| 694 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); | 706 ASSERT_TRUE(test::HasReferenceFilesInCheckout()); |
| 695 ASSERT_TRUE(embedded_test_server()->Start()); | 707 ASSERT_TRUE(embedded_test_server()->Start()); |
| 696 | 708 |
| 697 ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent()); | 709 ASSERT_TRUE(ForceMicrophoneVolumeTo100Percent()); |
| 698 | 710 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 AnalyzeSegmentsAndPrintResult( | 806 AnalyzeSegmentsAndPrintResult( |
| 795 ref_segments, actual_segments, reference_file, perf_modifier); | 807 ref_segments, actual_segments, reference_file, perf_modifier); |
| 796 | 808 |
| 797 DeleteFileUnlessTestFailed(recording, false); | 809 DeleteFileUnlessTestFailed(recording, false); |
| 798 DeleteFileUnlessTestFailed(actual_files_dir, true); | 810 DeleteFileUnlessTestFailed(actual_files_dir, true); |
| 799 } | 811 } |
| 800 | 812 |
| 801 // The AGC should apply non-zero gain here. | 813 // The AGC should apply non-zero gain here. |
| 802 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, | 814 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, |
| 803 MANUAL_TestAutoGainControlOnLowAudio) { | 815 MANUAL_TestAutoGainControlOnLowAudio) { |
| 816 // crbug.com/684680 |
| 817 #if defined(OS_MACOSX) |
| 818 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 819 #endif // defined(OS_MACOSX) |
| 804 ASSERT_NO_FATAL_FAILURE(TestAutoGainControl( | 820 ASSERT_NO_FATAL_FAILURE(TestAutoGainControl( |
| 805 kReferenceFile, kAudioOnlyCallConstraints, "_with_agc")); | 821 kReferenceFile, kAudioOnlyCallConstraints, "_with_agc")); |
| 806 } | 822 } |
| 807 | 823 |
| 808 // Since the AGC is off here there should be no gain at all. | 824 // Since the AGC is off here there should be no gain at all. |
| 809 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, | 825 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcAudioQualityBrowserTest, |
| 810 MANUAL_TestAutoGainIsOffWithAudioProcessingOff) { | 826 MANUAL_TestAutoGainIsOffWithAudioProcessingOff) { |
| 827 // crbug.com/684680 |
| 828 #if defined(OS_MACOSX) |
| 829 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 830 #endif // defined(OS_MACOSX) |
| 811 const char* kAudioCallWithoutAudioProcessing = | 831 const char* kAudioCallWithoutAudioProcessing = |
| 812 "{audio: { mandatory: { echoCancellation: false } } }"; | 832 "{audio: { mandatory: { echoCancellation: false } } }"; |
| 813 ASSERT_NO_FATAL_FAILURE(TestAutoGainControl( | 833 ASSERT_NO_FATAL_FAILURE(TestAutoGainControl( |
| 814 kReferenceFile, kAudioCallWithoutAudioProcessing, "_no_agc")); | 834 kReferenceFile, kAudioCallWithoutAudioProcessing, "_no_agc")); |
| 815 } | 835 } |
| OLD | NEW |