Index: ash/system/tray/system_tray_unittest.cc |
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc |
index b03c548a14ff0f405661e05fafa812349dd31fc6..28aaa8ae2da0675a7bc3a9b881c01b12af5c53fc 100644 |
--- a/ash/system/tray/system_tray_unittest.cc |
+++ b/ash/system/tray/system_tray_unittest.cc |
@@ -6,6 +6,8 @@ |
#include <vector> |
+#include "ash/accelerators/accelerator_controller.h" |
+#include "ash/volume_control_delegate.h" |
#include "ash/system/status_area_widget.h" |
#include "ash/system/tray/system_tray_item.h" |
#include "ash/test/ash_test_base.h" |
@@ -87,9 +89,56 @@ class TestItem : public SystemTrayItem { |
views::View* notification_view_; |
}; |
+class DummyVolumeControlDelegate : public VolumeControlDelegate { |
+ public: |
+ explicit DummyVolumeControlDelegate() {} |
+ virtual ~DummyVolumeControlDelegate() {} |
+ |
+ virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE { |
+ return true; |
+ } |
+ virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE { |
+ return true; |
+ } |
+ virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE { |
+ return true; |
+ } |
+ virtual void SetVolumePercent(double percent) OVERRIDE { |
+ } |
+ virtual bool IsAudioMuted() const OVERRIDE { |
+ return false; |
+ } |
+ virtual void SetAudioMuted(bool muted) OVERRIDE { |
+ } |
+ virtual float GetVolumeLevel() const OVERRIDE { |
+ return 0.0; |
+ } |
+ virtual void SetVolumeLevel(float level) OVERRIDE { |
+ } |
+ |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(DummyVolumeControlDelegate); |
+}; |
+ |
} // namespace |
-typedef AshTestBase SystemTrayTest; |
+class SystemTrayTest : public AshTestBase { |
+ public: |
+ SystemTrayTest() : AshTestBase() {} |
+ virtual ~SystemTrayTest() {} |
+ |
+ virtual void SetUp() OVERRIDE { |
+ AshTestBase::SetUp(); |
+ Shell::GetInstance()->accelerator_controller()->SetVolumeControlDelegate( |
+ scoped_ptr<ash::VolumeControlDelegate>(new |
+ DummyVolumeControlDelegate).Pass()); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(SystemTrayTest); |
+}; |
+ |
TEST_F(SystemTrayTest, SystemTrayDefaultView) { |
SystemTray* tray = GetSystemTray(); |