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

Side by Side Diff: chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc

Issue 194713010: duplicate the webrtc content_browser tests and browser tests with --enable-audio-track-processing on (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: moved everything to SetUpCommandLine Created 6 years, 9 months 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
« no previous file with comments | « no previous file | chrome/browser/media/chrome_webrtc_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <ctime> 5 #include <ctime>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process/launch.h" 10 #include "base/process/launch.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // devices. Tick 'show disabled devices'. 82 // devices. Tick 'show disabled devices'.
83 // 3. You should see a 'stero mix' device - this is what your speakers output. 83 // 3. You should see a 'stero mix' device - this is what your speakers output.
84 // Right click > Properties. 84 // Right click > Properties.
85 // 4. In the Listen tab for the mix device, check the 'listen to this device' 85 // 4. In the Listen tab for the mix device, check the 'listen to this device'
86 // checkbox. Ensure the mix device is the default recording device. 86 // checkbox. Ensure the mix device is the default recording device.
87 // 5. Launch chrome and try playing a video with sound. You should see 87 // 5. Launch chrome and try playing a video with sound. You should see
88 // in the volume meter for the mix device. Configure the mix device to have 88 // in the volume meter for the mix device. Configure the mix device to have
89 // 50 / 100 in level. Also go into the playback tab, right-click Speakers, 89 // 50 / 100 in level. Also go into the playback tab, right-click Speakers,
90 // and set that level to 50 / 100. Otherwise you will get distortion in 90 // and set that level to 50 / 100. Otherwise you will get distortion in
91 // the recording. 91 // the recording.
92 class WebRtcAudioQualityBrowserTest : public WebRtcTestBase { 92 class WebRtcAudioQualityBrowserTest : public WebRtcTestBase,
93 public testing::WithParamInterface<bool> {
93 public: 94 public:
95 WebRtcAudioQualityBrowserTest() {}
94 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 96 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
95 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); 97 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem();
96 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. 98 DetectErrorsInJavaScript(); // Look for errors in our rather complex js.
97 } 99 }
98 100
99 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 101 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
100 // This test expects real device handling and requires a real webcam / audio 102 // This test expects real device handling and requires a real webcam / audio
101 // device; it will not work with fake devices. 103 // device; it will not work with fake devices.
102 EXPECT_FALSE(command_line->HasSwitch( 104 EXPECT_FALSE(command_line->HasSwitch(
103 switches::kUseFakeDeviceForMediaStream)); 105 switches::kUseFakeDeviceForMediaStream));
104 EXPECT_FALSE(command_line->HasSwitch( 106 EXPECT_FALSE(command_line->HasSwitch(
105 switches::kUseFakeUIForMediaStream)); 107 switches::kUseFakeUIForMediaStream));
108
109 bool enable_audio_track_processing = GetParam();
110 if (enable_audio_track_processing)
111 command_line->AppendSwitch(switches::kEnableAudioTrackProcessing);
106 } 112 }
107 113
108 bool HasAllRequiredResources() { 114 bool HasAllRequiredResources() {
109 base::FilePath reference_file = GetTestDataDir().Append(kReferenceFile); 115 base::FilePath reference_file = GetTestDataDir().Append(kReferenceFile);
110 if (!base::PathExists(reference_file)) { 116 if (!base::PathExists(reference_file)) {
111 LOG(ERROR) << "Cannot find the reference file to be used for audio " 117 LOG(ERROR) << "Cannot find the reference file to be used for audio "
112 << "quality comparison: " << reference_file.value(); 118 << "quality comparison: " << reference_file.value();
113 return false; 119 return false;
114 } 120 }
115 return true; 121 return true;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // There are two tab-separated numbers on the format x.xxx, e.g. 5 chars each. 360 // There are two tab-separated numbers on the format x.xxx, e.g. 5 chars each.
355 std::size_t first_number_pos = anchor_pos + result_anchor.length(); 361 std::size_t first_number_pos = anchor_pos + result_anchor.length();
356 *raw_mos = result.substr(first_number_pos, 5); 362 *raw_mos = result.substr(first_number_pos, 5);
357 EXPECT_TRUE(CanParseAsFloat(*raw_mos)) << "Failed to parse raw MOS number."; 363 EXPECT_TRUE(CanParseAsFloat(*raw_mos)) << "Failed to parse raw MOS number.";
358 *mos_lqo = result.substr(first_number_pos + 5 + 1, 5); 364 *mos_lqo = result.substr(first_number_pos + 5 + 1, 5);
359 EXPECT_TRUE(CanParseAsFloat(*mos_lqo)) << "Failed to parse MOS LQO number."; 365 EXPECT_TRUE(CanParseAsFloat(*mos_lqo)) << "Failed to parse MOS LQO number.";
360 366
361 return true; 367 return true;
362 } 368 }
363 369
370 static const bool kRunTestsWithFlag[] = { false, true };
371 INSTANTIATE_TEST_CASE_P(WebRtcAudioQualityBrowserTests,
372 WebRtcAudioQualityBrowserTest,
373 testing::ValuesIn(kRunTestsWithFlag));
374
364 // Should be enabled for Linux, but is flaky. http://crbug.com/340197. 375 // Should be enabled for Linux, but is flaky. http://crbug.com/340197.
365 #if defined(OS_WIN) 376 #if defined(OS_WIN)
366 // Only implemented on Linux and Windows for now. 377 // Only implemented on Linux and Windows for now.
367 #define MAYBE_MANUAL_TestAudioQuality MANUAL_TestAudioQuality 378 #define MAYBE_MANUAL_TestAudioQuality MANUAL_TestAudioQuality
368 #else 379 #else
369 #define MAYBE_MANUAL_TestAudioQuality DISABLED_MANUAL_TestAudioQuality 380 #define MAYBE_MANUAL_TestAudioQuality DISABLED_MANUAL_TestAudioQuality
370 #endif 381 #endif
371 382
372 IN_PROC_BROWSER_TEST_F(WebRtcAudioQualityBrowserTest, 383 IN_PROC_BROWSER_TEST_P(WebRtcAudioQualityBrowserTest,
373 MAYBE_MANUAL_TestAudioQuality) { 384 MAYBE_MANUAL_TestAudioQuality) {
374 #if defined(OS_WIN) 385 #if defined(OS_WIN)
375 if (base::win::GetVersion() < base::win::VERSION_VISTA) { 386 if (base::win::GetVersion() < base::win::VERSION_VISTA) {
376 // It would take work to implement this on XP; not prioritized right now. 387 // It would take work to implement this on XP; not prioritized right now.
377 LOG(ERROR) << "This test is not implemented for Windows XP."; 388 LOG(ERROR) << "This test is not implemented for Windows XP.";
378 return; 389 return;
379 } 390 }
380 #endif 391 #endif
381 ASSERT_TRUE(HasAllRequiredResources()); 392 ASSERT_TRUE(HasAllRequiredResources());
382 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 393 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 &raw_mos, &mos_lqo)); 452 &raw_mos, &mos_lqo));
442 453
443 perf_test::PrintResult("audio_pesq", "", "raw_mos", raw_mos, "score", true); 454 perf_test::PrintResult("audio_pesq", "", "raw_mos", raw_mos, "score", true);
444 perf_test::PrintResult("audio_pesq", "", "mos_lqo", mos_lqo, "score", true); 455 perf_test::PrintResult("audio_pesq", "", "mos_lqo", mos_lqo, "score", true);
445 456
446 EXPECT_TRUE(base::DeleteFile(recording, false)); 457 EXPECT_TRUE(base::DeleteFile(recording, false));
447 EXPECT_TRUE(base::DeleteFile(trimmed_recording, false)); 458 EXPECT_TRUE(base::DeleteFile(trimmed_recording, false));
448 459
449 ASSERT_TRUE(peerconnection_server_.Stop()); 460 ASSERT_TRUE(peerconnection_server_.Stop());
450 } 461 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/chrome_webrtc_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698