summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-10 08:49:19 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-10 08:49:19 +0000
commit4c023028d3d1150b35592881880259094eba0b2d (patch)
tree20d0f7721ba0214b25a56aa66dcb00b22b1645a6 /content
parent0ac1b7125789e254d88cbf5667db859f9af68a02 (diff)
downloadchromium_src-4c023028d3d1150b35592881880259094eba0b2d.zip
chromium_src-4c023028d3d1150b35592881880259094eba0b2d.tar.gz
chromium_src-4c023028d3d1150b35592881880259094eba0b2d.tar.bz2
Add a COM initializer for the IO thread to accomodate the WASAPI changes and enable two tests now that webrtc has been updated (see r109241).
Review URL: http://codereview.chromium.org/8509010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/renderer/media/webrtc_audio_device_unittest.cc8
-rw-r--r--content/test/webrtc_audio_device_test.cc10
-rw-r--r--content/test/webrtc_audio_device_test.h11
3 files changed, 22 insertions, 7 deletions
diff --git a/content/renderer/media/webrtc_audio_device_unittest.cc b/content/renderer/media/webrtc_audio_device_unittest.cc
index 10d4ba8..ec54ffe 100644
--- a/content/renderer/media/webrtc_audio_device_unittest.cc
+++ b/content/renderer/media/webrtc_audio_device_unittest.cc
@@ -45,9 +45,7 @@ bool IsRunningHeadless() {
// Basic test that instantiates and initializes an instance of
// WebRtcAudioDeviceImpl.
-// TODO(tommi): Re-enable when the flakiness of CpuWindows in webrtc has
-// been fixed.
-TEST_F(WebRTCAudioDeviceTest, DISABLED_Construct) {
+TEST_F(WebRTCAudioDeviceTest, Construct) {
AudioUtil audio_util;
set_audio_util_callback(&audio_util);
scoped_refptr<WebRtcAudioDeviceImpl> audio_device(
@@ -65,9 +63,7 @@ TEST_F(WebRTCAudioDeviceTest, DISABLED_Construct) {
// Uses WebRtcAudioDeviceImpl to play a local wave file.
// Disabled when running headless since the bots don't have the required config.
-// TODO(tommi): Re-enable when the flakiness of CpuWindows in webrtc has
-// been fixed.
-TEST_F(WebRTCAudioDeviceTest, DISABLED_PlayLocalFile) {
+TEST_F(WebRTCAudioDeviceTest, PlayLocalFile) {
if (IsRunningHeadless())
return;
diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc
index 3fc11fc2..9187a5e 100644
--- a/content/test/webrtc_audio_device_test.cc
+++ b/content/test/webrtc_audio_device_test.cc
@@ -10,6 +10,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/test/signaling_task.h"
#include "base/test/test_timeouts.h"
+#include "base/win/scoped_com_initializer.h"
#include "content/browser/renderer_host/media/audio_renderer_host.h"
#include "content/browser/renderer_host/media/mock_media_observer.h"
#include "content/browser/resource_context.h"
@@ -28,6 +29,7 @@
#include "third_party/webrtc/voice_engine/main/interface/voe_file.h"
#include "third_party/webrtc/voice_engine/main/interface/voe_network.h"
+using base::win::ScopedCOMInitializer;
using testing::_;
using testing::InvokeWithoutArgs;
using testing::Return;
@@ -57,7 +59,8 @@ class WebRTCMockRenderProcess : public RenderProcess {
// duration of the test.
class ReplaceContentClientRenderer {
public:
- ReplaceContentClientRenderer(content::ContentRendererClient* new_renderer) {
+ explicit ReplaceContentClientRenderer(
+ content::ContentRendererClient* new_renderer) {
saved_renderer_ = content::GetContentClient()->renderer();
content::GetContentClient()->set_renderer(new_renderer);
}
@@ -129,6 +132,10 @@ bool WebRTCAudioDeviceTest::Send(IPC::Message* message) {
}
void WebRTCAudioDeviceTest::InitializeIOThread(const char* thread_name) {
+ // We initialize COM (STA) on our IO thread as is done in Chrome.
+ // See BrowserProcessSubThread::Init.
+ initialize_com_.reset(new ScopedCOMInitializer());
+
// Set the current thread as the IO thread.
io_thread_.reset(new content::TestBrowserThread(content::BrowserThread::IO,
MessageLoop::current()));
@@ -144,6 +151,7 @@ void WebRTCAudioDeviceTest::UninitializeIOThread() {
DestroyChannel();
resource_context_.reset();
test_request_context_ = NULL;
+ initialize_com_.reset();
}
void WebRTCAudioDeviceTest::CreateChannel(
diff --git a/content/test/webrtc_audio_device_test.h b/content/test/webrtc_audio_device_test.h
index 646c7c7..0c3779c 100644
--- a/content/test/webrtc_audio_device_test.h
+++ b/content/test/webrtc_audio_device_test.h
@@ -6,6 +6,8 @@
#define CONTENT_TEST_WEBRTC_AUDIO_DEVICE_TEST_H_
#pragma once
+#include <string>
+
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -21,6 +23,12 @@ class AudioRendererHost;
class RenderThreadImpl;
class WebRTCMockRenderProcess;
+namespace base {
+namespace win {
+class ScopedCOMInitializer;
+}
+}
+
namespace content {
class ContentRendererClient;
class ResourceContext;
@@ -93,6 +101,7 @@ class WebRTCAutoDelete {
// when the audio code queries for hardware capabilities on the IO thread.
class AudioUtilInterface {
public:
+ virtual ~AudioUtilInterface() {}
virtual double GetAudioHardwareSampleRate() = 0;
virtual double GetAudioInputHardwareSampleRate() = 0;
};
@@ -170,6 +179,8 @@ class WebRTCAudioDeviceTest
scoped_ptr<content::TestBrowserThread> ui_thread_;
// Initialized on our IO thread to satisfy BrowserThread::IO checks.
scoped_ptr<content::TestBrowserThread> io_thread_;
+ // COM initialization on the IO thread for Windows.
+ scoped_ptr<base::win::ScopedCOMInitializer> initialize_com_;
};
// A very basic implementation of webrtc::Transport that acts as a transport