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

Side by Side Diff: media/audio/audio_low_latency_input_output_unittest.cc

Issue 9255017: Add thread safety to AudioManagerBase to protect access to the audio thread member variable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style issue Created 8 years, 11 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
« no previous file with comments | « content/test/webrtc_audio_device_test.cc ('k') | media/audio/audio_manager.h » ('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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/environment.h" 6 #include "base/environment.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h"
9 #include "base/path_service.h" 10 #include "base/path_service.h"
10 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
11 #include "base/test/test_timeouts.h" 12 #include "base/test/test_timeouts.h"
12 #include "base/time.h" 13 #include "base/time.h"
13 #include "base/win/scoped_com_initializer.h" 14 #include "base/win/scoped_com_initializer.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "media/audio/audio_io.h" 16 #include "media/audio/audio_io.h"
16 #include "media/audio/audio_manager_base.h" 17 #include "media/audio/audio_manager_base.h"
17 #include "media/audio/audio_util.h" 18 #include "media/audio/audio_util.h"
18 #if defined(OS_LINUX) || defined(OS_OPENBSD) 19 #if defined(OS_LINUX) || defined(OS_OPENBSD)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // the GetMessageLoop() method to ensure that we can run our tests on 76 // the GetMessageLoop() method to ensure that we can run our tests on
76 // the main thread instead of the audio thread. 77 // the main thread instead of the audio thread.
77 class MockAudioManager : public AudioManagerAnyPlatform { 78 class MockAudioManager : public AudioManagerAnyPlatform {
78 public: 79 public:
79 MockAudioManager() { 80 MockAudioManager() {
80 Init(); 81 Init();
81 } 82 }
82 83
83 virtual ~MockAudioManager() {} 84 virtual ~MockAudioManager() {}
84 85
85 virtual MessageLoop* GetMessageLoop() OVERRIDE { 86 virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE {
86 return MessageLoop::current(); 87 return MessageLoop::current()->message_loop_proxy();
87 } 88 }
88 89
89 private: 90 private:
90 DISALLOW_COPY_AND_ASSIGN(MockAudioManager); 91 DISALLOW_COPY_AND_ASSIGN(MockAudioManager);
91 }; 92 };
92 93
93 // Test fixture class. 94 // Test fixture class.
94 class AudioLowLatencyInputOutputTest : public testing::Test { 95 class AudioLowLatencyInputOutputTest : public testing::Test {
95 protected: 96 protected:
96 AudioLowLatencyInputOutputTest() 97 AudioLowLatencyInputOutputTest()
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 aos->Stop(); 451 aos->Stop();
451 ais->Stop(); 452 ais->Stop();
452 453
453 // All Close() operations that run on the mocked audio thread, 454 // All Close() operations that run on the mocked audio thread,
454 // should be synchronous and not post additional close tasks to 455 // should be synchronous and not post additional close tasks to
455 // mocked the audio thread. Hence, there is no need to call 456 // mocked the audio thread. Hence, there is no need to call
456 // message_loop()->RunAllPending() after the Close() methods. 457 // message_loop()->RunAllPending() after the Close() methods.
457 aos->Close(); 458 aos->Close();
458 ais->Close(); 459 ais->Close();
459 } 460 }
OLDNEW
« no previous file with comments | « content/test/webrtc_audio_device_test.cc ('k') | media/audio/audio_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698