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

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

Issue 217553002: Revert 260213 "Relanding Switched main WebRTC browser tests to u..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 testing::WithParamInterface<bool> {
94 public: 94 public:
95 WebRtcAudioQualityBrowserTest() {} 95 WebRtcAudioQualityBrowserTest() {}
96 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 96 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
97 test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); 97 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem();
98 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. 98 DetectErrorsInJavaScript(); // Look for errors in our rather complex js.
99 } 99 }
100 100
101 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 101 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
102 // 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
103 // device; it will not work with fake devices. 103 // device; it will not work with fake devices.
104 EXPECT_FALSE(command_line->HasSwitch( 104 EXPECT_FALSE(command_line->HasSwitch(
105 switches::kUseFakeDeviceForMediaStream)); 105 switches::kUseFakeDeviceForMediaStream));
106 EXPECT_FALSE(command_line->HasSwitch( 106 EXPECT_FALSE(command_line->HasSwitch(
107 switches::kUseFakeUIForMediaStream)); 107 switches::kUseFakeUIForMediaStream));
(...skipping 22 matching lines...) Expand all
130 void PlayAudioFile(content::WebContents* tab_contents) { 130 void PlayAudioFile(content::WebContents* tab_contents) {
131 EXPECT_EQ("ok-playing", ExecuteJavascript("playAudioFile()", tab_contents)); 131 EXPECT_EQ("ok-playing", ExecuteJavascript("playAudioFile()", tab_contents));
132 } 132 }
133 133
134 void EstablishCall(content::WebContents* from_tab, 134 void EstablishCall(content::WebContents* from_tab,
135 content::WebContents* to_tab) { 135 content::WebContents* to_tab) {
136 EXPECT_EQ("ok-negotiating", 136 EXPECT_EQ("ok-negotiating",
137 ExecuteJavascript("negotiateCall()", from_tab)); 137 ExecuteJavascript("negotiateCall()", from_tab));
138 138
139 // Ensure the call gets up on both sides. 139 // Ensure the call gets up on both sides.
140 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", 140 EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()",
141 "active", from_tab)); 141 "active", from_tab));
142 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", 142 EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()",
143 "active", to_tab)); 143 "active", to_tab));
144 } 144 }
145 145
146 base::FilePath CreateTemporaryWaveFile() { 146 base::FilePath CreateTemporaryWaveFile() {
147 base::FilePath filename; 147 base::FilePath filename;
148 EXPECT_TRUE(base::CreateTemporaryFile(&filename)); 148 EXPECT_TRUE(base::CreateTemporaryFile(&filename));
149 base::FilePath wav_filename = 149 base::FilePath wav_filename =
150 filename.AddExtension(FILE_PATH_LITERAL(".wav")); 150 filename.AddExtension(FILE_PATH_LITERAL(".wav"));
151 EXPECT_TRUE(base::Move(filename, wav_filename)); 151 EXPECT_TRUE(base::Move(filename, wav_filename));
152 return wav_filename; 152 return wav_filename;
153 } 153 }
154 154
155 test::PeerConnectionServerRunner peerconnection_server_; 155 PeerConnectionServerRunner peerconnection_server_;
156 }; 156 };
157 157
158 class AudioRecorder { 158 class AudioRecorder {
159 public: 159 public:
160 AudioRecorder(): recording_application_(base::kNullProcessHandle) {} 160 AudioRecorder(): recording_application_(base::kNullProcessHandle) {}
161 ~AudioRecorder() {} 161 ~AudioRecorder() {}
162 162
163 // Starts the recording program for the specified duration. Returns true 163 // Starts the recording program for the specified duration. Returns true
164 // on success. 164 // on success.
165 bool StartRecording(int duration_sec, const base::FilePath& output_file, 165 bool StartRecording(int duration_sec, const base::FilePath& output_file,
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 ExecuteJavascript("preparePeerConnection()", left_tab)); 412 ExecuteJavascript("preparePeerConnection()", left_tab));
413 413
414 AddAudioFile(kReferenceFileRelativeUrl, left_tab); 414 AddAudioFile(kReferenceFileRelativeUrl, left_tab);
415 415
416 EstablishCall(left_tab, right_tab); 416 EstablishCall(left_tab, right_tab);
417 417
418 // Note: the media flow isn't necessarily established on the connection just 418 // Note: the media flow isn't necessarily established on the connection just
419 // because the ready state is ok on both sides. We sleep a bit between call 419 // because the ready state is ok on both sides. We sleep a bit between call
420 // establishment and playing to avoid cutting of the beginning of the audio 420 // establishment and playing to avoid cutting of the beginning of the audio
421 // file. 421 // file.
422 test::SleepInJavascript(left_tab, 2000); 422 SleepInJavascript(left_tab, 2000);
423 423
424 base::FilePath recording = CreateTemporaryWaveFile(); 424 base::FilePath recording = CreateTemporaryWaveFile();
425 425
426 // Note: the sound clip is about 10 seconds: record for 15 seconds to get some 426 // Note: the sound clip is about 10 seconds: record for 15 seconds to get some
427 // safety margins on each side. 427 // safety margins on each side.
428 AudioRecorder recorder; 428 AudioRecorder recorder;
429 static int kRecordingTimeSeconds = 15; 429 static int kRecordingTimeSeconds = 15;
430 ASSERT_TRUE(recorder.StartRecording(kRecordingTimeSeconds, recording, true)); 430 ASSERT_TRUE(recorder.StartRecording(kRecordingTimeSeconds, recording, true));
431 431
432 PlayAudioFile(left_tab); 432 PlayAudioFile(left_tab);
(...skipping 18 matching lines...) Expand all
451 &raw_mos, &mos_lqo)); 451 &raw_mos, &mos_lqo));
452 452
453 perf_test::PrintResult("audio_pesq", "", "raw_mos", raw_mos, "score", true); 453 perf_test::PrintResult("audio_pesq", "", "raw_mos", raw_mos, "score", true);
454 perf_test::PrintResult("audio_pesq", "", "mos_lqo", mos_lqo, "score", true); 454 perf_test::PrintResult("audio_pesq", "", "mos_lqo", mos_lqo, "score", true);
455 455
456 EXPECT_TRUE(base::DeleteFile(recording, false)); 456 EXPECT_TRUE(base::DeleteFile(recording, false));
457 EXPECT_TRUE(base::DeleteFile(trimmed_recording, false)); 457 EXPECT_TRUE(base::DeleteFile(trimmed_recording, false));
458 458
459 ASSERT_TRUE(peerconnection_server_.Stop()); 459 ASSERT_TRUE(peerconnection_server_.Stop());
460 } 460 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698