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

Side by Side Diff: content/browser/webrtc/webrtc_audio_debug_recordings_browsertest.cc

Issue 2801983003: Switching WebRTC browser test from AudioManager::HasAudioOutputDevices() to AudioSystem interface. (Closed)
Patch Set: moved HasAudioOutputDevices() to WebRtcContentBrowserTestBase Created 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/process/process_handle.h" 7 #include "base/process/process_handle.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "content/browser/web_contents/web_contents_impl.h" 11 #include "content/browser/web_contents/web_contents_impl.h"
12 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" 12 #include "content/browser/webrtc/webrtc_content_browsertest_base.h"
13 #include "content/browser/webrtc/webrtc_internals.h" 13 #include "content/browser/webrtc/webrtc_internals.h"
14 #include "content/public/test/browser_test_utils.h" 14 #include "content/public/test/browser_test_utils.h"
15 #include "content/public/test/content_browser_test_utils.h" 15 #include "content/public/test/content_browser_test_utils.h"
16 #include "content/shell/browser/shell.h" 16 #include "content/shell/browser/shell.h"
17 #include "media/audio/audio_manager.h"
18 #include "net/test/embedded_test_server/embedded_test_server.h" 17 #include "net/test/embedded_test_server/embedded_test_server.h"
19 18
20 #if defined(OS_WIN) 19 #if defined(OS_WIN)
21 #define IntToStringType base::IntToString16 20 #define IntToStringType base::IntToString16
22 #else 21 #else
23 #define IntToStringType base::IntToString 22 #define IntToStringType base::IntToString
24 #endif 23 #endif
25 24
26 namespace { 25 namespace {
27 26
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 #endif 105 #endif
107 106
108 // This tests will make a complete PeerConnection-based call, verify that 107 // This tests will make a complete PeerConnection-based call, verify that
109 // video is playing for the call, and verify that non-empty audio debug 108 // video is playing for the call, and verify that non-empty audio debug
110 // recording files exist. The recording is enabled through webrtc-internals. The 109 // recording files exist. The recording is enabled through webrtc-internals. The
111 // HTML and Javascript is bypassed since it would trigger a file picker dialog. 110 // HTML and Javascript is bypassed since it would trigger a file picker dialog.
112 // Instead, the dialog callback FileSelected() is invoked directly. In fact, 111 // Instead, the dialog callback FileSelected() is invoked directly. In fact,
113 // there's never a webrtc-internals page opened at all since that's not needed. 112 // there's never a webrtc-internals page opened at all since that's not needed.
114 IN_PROC_BROWSER_TEST_F(WebRtcAudioDebugRecordingsBrowserTest, 113 IN_PROC_BROWSER_TEST_F(WebRtcAudioDebugRecordingsBrowserTest,
115 MAYBE_CallWithAudioDebugRecordings) { 114 MAYBE_CallWithAudioDebugRecordings) {
116 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { 115 if (!HasAudioOutputDevices()) {
117 LOG(INFO) << "Missing output devices: skipping test..."; 116 LOG(INFO) << "Missing output devices: skipping test...";
118 return; 117 return;
119 } 118 }
120 119
121 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true); 120 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true);
122 121
123 ASSERT_TRUE(embedded_test_server()->Start()); 122 ASSERT_TRUE(embedded_test_server()->Start());
124 123
125 // We must navigate somewhere first so that the render process is created. 124 // We must navigate somewhere first so that the render process is created.
126 NavigateToURL(shell(), GURL("")); 125 NavigateToURL(shell(), GURL(""));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 DISABLED_CallWithAudioDebugRecordingsEnabledThenDisabled 189 DISABLED_CallWithAudioDebugRecordingsEnabledThenDisabled
191 #else 190 #else
192 #define MAYBE_CallWithAudioDebugRecordingsEnabledThenDisabled \ 191 #define MAYBE_CallWithAudioDebugRecordingsEnabledThenDisabled \
193 CallWithAudioDebugRecordingsEnabledThenDisabled 192 CallWithAudioDebugRecordingsEnabledThenDisabled
194 #endif 193 #endif
195 194
196 // As above, but enable and disable recordings before starting a call. No files 195 // As above, but enable and disable recordings before starting a call. No files
197 // should be created. 196 // should be created.
198 IN_PROC_BROWSER_TEST_F(WebRtcAudioDebugRecordingsBrowserTest, 197 IN_PROC_BROWSER_TEST_F(WebRtcAudioDebugRecordingsBrowserTest,
199 MAYBE_CallWithAudioDebugRecordingsEnabledThenDisabled) { 198 MAYBE_CallWithAudioDebugRecordingsEnabledThenDisabled) {
200 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { 199 if (!HasAudioOutputDevices()) {
201 LOG(INFO) << "Missing output devices: skipping test..."; 200 LOG(INFO) << "Missing output devices: skipping test...";
202 return; 201 return;
203 } 202 }
204 203
205 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true); 204 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true);
206 205
207 ASSERT_TRUE(embedded_test_server()->Start()); 206 ASSERT_TRUE(embedded_test_server()->Start());
208 207
209 // We must navigate somewhere first so that the render process is created. 208 // We must navigate somewhere first so that the render process is created.
210 NavigateToURL(shell(), GURL("")); 209 NavigateToURL(shell(), GURL(""));
(...skipping 30 matching lines...) Expand all
241 // Renderer crashes on Android M. https://crbug.com/535728. 240 // Renderer crashes on Android M. https://crbug.com/535728.
242 #define MAYBE_TwoCallsWithAudioDebugRecordings \ 241 #define MAYBE_TwoCallsWithAudioDebugRecordings \
243 DISABLED_TwoCallsWithAudioDebugRecordings 242 DISABLED_TwoCallsWithAudioDebugRecordings
244 #else 243 #else
245 #define MAYBE_TwoCallsWithAudioDebugRecordings TwoCallsWithAudioDebugRecordings 244 #define MAYBE_TwoCallsWithAudioDebugRecordings TwoCallsWithAudioDebugRecordings
246 #endif 245 #endif
247 246
248 // Same test as CallWithAudioDebugRecordings, but does two parallel calls. 247 // Same test as CallWithAudioDebugRecordings, but does two parallel calls.
249 IN_PROC_BROWSER_TEST_F(WebRtcAudioDebugRecordingsBrowserTest, 248 IN_PROC_BROWSER_TEST_F(WebRtcAudioDebugRecordingsBrowserTest,
250 MAYBE_TwoCallsWithAudioDebugRecordings) { 249 MAYBE_TwoCallsWithAudioDebugRecordings) {
251 if (!media::AudioManager::Get()->HasAudioOutputDevices()) { 250 if (!HasAudioOutputDevices()) {
252 LOG(INFO) << "Missing output devices: skipping test..."; 251 LOG(INFO) << "Missing output devices: skipping test...";
253 return; 252 return;
254 } 253 }
255 254
256 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true); 255 bool prev_io_allowed = base::ThreadRestrictions::SetIOAllowed(true);
257 256
258 ASSERT_TRUE(embedded_test_server()->Start()); 257 ASSERT_TRUE(embedded_test_server()->Start());
259 258
260 // We must navigate somewhere first so that the render process is created. 259 // We must navigate somewhere first so that the render process is created.
261 NavigateToURL(shell(), GURL("")); 260 NavigateToURL(shell(), GURL(""));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 } 331 }
333 332
334 // Verify that no other files exist and remove temp dir. 333 // Verify that no other files exist and remove temp dir.
335 EXPECT_TRUE(base::IsDirectoryEmpty(temp_dir_path)); 334 EXPECT_TRUE(base::IsDirectoryEmpty(temp_dir_path));
336 EXPECT_TRUE(base::DeleteFile(temp_dir_path, false)); 335 EXPECT_TRUE(base::DeleteFile(temp_dir_path, false));
337 336
338 base::ThreadRestrictions::SetIOAllowed(prev_io_allowed); 337 base::ThreadRestrictions::SetIOAllowed(prev_io_allowed);
339 } 338 }
340 339
341 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webrtc/webrtc_audio_browsertest.cc ('k') | content/browser/webrtc/webrtc_content_browsertest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698