OLD | NEW |
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 "chrome/browser/notifications/notification_audio_controller.h" | 5 #include "chrome/browser/notifications/notification_audio_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 class NotificationAudioControllerTest : public testing::Test { | 33 class NotificationAudioControllerTest : public testing::Test { |
34 public: | 34 public: |
35 NotificationAudioControllerTest() { | 35 NotificationAudioControllerTest() { |
36 audio_manager_.reset(media::AudioManager::Create()); | 36 audio_manager_.reset(media::AudioManager::Create()); |
37 notification_audio_controller_ = new NotificationAudioController(); | 37 notification_audio_controller_ = new NotificationAudioController(); |
38 notification_audio_controller_->UseFakeAudioOutputForTest(); | 38 notification_audio_controller_->UseFakeAudioOutputForTest(); |
39 } | 39 } |
40 | 40 |
41 virtual ~NotificationAudioControllerTest() { | 41 virtual ~NotificationAudioControllerTest() { |
42 notification_audio_controller_->RequestShutdown(); | 42 notification_audio_controller_->RequestShutdown(); |
| 43 base::RunLoop().RunUntilIdle(); |
43 audio_manager_.reset(); | 44 audio_manager_.reset(); |
44 } | 45 } |
45 | 46 |
46 protected: | 47 protected: |
47 NotificationAudioController* notification_audio_controller() { | 48 NotificationAudioController* notification_audio_controller() { |
48 return notification_audio_controller_; | 49 return notification_audio_controller_; |
49 } | 50 } |
50 Profile* profile() { return &profile_; } | 51 Profile* profile() { return &profile_; } |
51 | 52 |
52 size_t GetHandlersSize() { | 53 size_t GetHandlersSize() { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 notification_audio_controller()->RequestPlayNotificationSound( | 118 notification_audio_controller()->RequestPlayNotificationSound( |
118 kDummyNotificationId, | 119 kDummyNotificationId, |
119 profile(), | 120 profile(), |
120 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); | 121 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); |
121 notification_audio_controller()->RequestPlayNotificationSound( | 122 notification_audio_controller()->RequestPlayNotificationSound( |
122 kDummyNotificationId, | 123 kDummyNotificationId, |
123 &profile2, | 124 &profile2, |
124 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); | 125 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); |
125 EXPECT_EQ(2u, GetHandlersSize()); | 126 EXPECT_EQ(2u, GetHandlersSize()); |
126 } | 127 } |
OLD | NEW |