| 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 run_loop; |
| 44 run_loop.RunUntilIdle(); |
| 43 audio_manager_.reset(); | 45 audio_manager_.reset(); |
| 44 } | 46 } |
| 45 | 47 |
| 46 protected: | 48 protected: |
| 47 NotificationAudioController* notification_audio_controller() { | 49 NotificationAudioController* notification_audio_controller() { |
| 48 return notification_audio_controller_; | 50 return notification_audio_controller_; |
| 49 } | 51 } |
| 50 Profile* profile() { return &profile_; } | 52 Profile* profile() { return &profile_; } |
| 51 | 53 |
| 52 size_t GetHandlersSize() { | 54 size_t GetHandlersSize() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 notification_audio_controller()->RequestPlayNotificationSound( | 119 notification_audio_controller()->RequestPlayNotificationSound( |
| 118 kDummyNotificationId, | 120 kDummyNotificationId, |
| 119 profile(), | 121 profile(), |
| 120 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); | 122 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); |
| 121 notification_audio_controller()->RequestPlayNotificationSound( | 123 notification_audio_controller()->RequestPlayNotificationSound( |
| 122 kDummyNotificationId, | 124 kDummyNotificationId, |
| 123 &profile2, | 125 &profile2, |
| 124 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); | 126 base::StringPiece(kTestAudioData, arraysize(kTestAudioData))); |
| 125 EXPECT_EQ(2u, GetHandlersSize()); | 127 EXPECT_EQ(2u, GetHandlersSize()); |
| 126 } | 128 } |
| OLD | NEW |