Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/ash/volume_controller_chromeos.h" | 5 #include "chrome/browser/ui/ash/volume_controller_chromeos.h" |
| 6 | 6 |
| 7 #include "chrome/browser/chromeos/audio/audio_handler.h" | 7 #include "chrome/browser/chromeos/audio/audio_handler.h" |
| 8 #include "chrome/browser/chromeos/audio/audio_mixer.h" | 8 #include "chrome/browser/chromeos/audio/audio_mixer.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void SetVolumePercent(double percent) OVERRIDE { | 29 virtual void SetVolumePercent(double percent) OVERRIDE { |
| 30 volume_ = percent; | 30 volume_ = percent; |
| 31 } | 31 } |
| 32 | 32 |
| 33 virtual bool IsMuted() OVERRIDE { | 33 virtual bool IsMuted() OVERRIDE { |
| 34 return is_muted_; | 34 return is_muted_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 virtual void SetMuted(bool do_mute) OVERRIDE { | 37 virtual void SetMuted(bool do_mute) OVERRIDE { |
|
Daniel Erat
2012/08/29 15:37:00
nit: s/do_mute/mute/
pastarmovj
2012/08/29 16:15:52
Done.
| |
| 38 is_muted_ = do_mute; | 38 is_muted_ = do_mute; |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool IsMuteLocked() OVERRIDE { | |
| 42 return is_mute_locked_; | |
| 43 } | |
| 44 | |
| 45 void SetMuteLocked(bool locked) OVERRIDE { | |
| 46 is_mute_locked_ = locked; | |
| 47 } | |
| 48 | |
| 49 bool IsCaptureMuted() OVERRIDE { | |
| 50 return is_capture_muted_; | |
| 51 } | |
| 52 | |
| 53 void SetCaptureMuted(bool locked) OVERRIDE { | |
|
Daniel Erat
2012/08/29 15:37:00
s/locked/mute/
pastarmovj
2012/08/29 16:15:52
Done.
| |
| 54 is_capture_muted_ = locked; | |
| 55 } | |
| 56 | |
| 57 bool IsCaptureMuteLocked() OVERRIDE { | |
| 58 return is_capture_mute_locked_; | |
| 59 } | |
| 60 | |
| 61 void SetCaptureMuteLocked(bool locked) OVERRIDE { | |
| 62 is_capture_mute_locked_ = locked; | |
| 63 } | |
| 64 | |
| 41 private: | 65 private: |
| 42 double volume_; | 66 double volume_; |
| 43 bool is_muted_; | 67 bool is_muted_; |
| 68 bool is_mute_locked_; | |
| 69 bool is_capture_muted_; | |
| 70 bool is_capture_mute_locked_; | |
| 44 | 71 |
| 45 DISALLOW_COPY_AND_ASSIGN(MockAudioMixer); | 72 DISALLOW_COPY_AND_ASSIGN(MockAudioMixer); |
| 46 }; | 73 }; |
| 47 | 74 |
| 48 // This class has to be browsertest because AudioHandler uses prefs_service. | 75 // This class has to be browsertest because AudioHandler uses prefs_service. |
| 49 class VolumeControllerTest : public InProcessBrowserTest { | 76 class VolumeControllerTest : public InProcessBrowserTest { |
| 50 public: | 77 public: |
| 51 VolumeControllerTest() {} | 78 VolumeControllerTest() {} |
| 52 | 79 |
| 53 virtual void SetUpOnMainThread() OVERRIDE { | 80 virtual void SetUpOnMainThread() OVERRIDE { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 145 EXPECT_DOUBLE_EQ(0.0, audio_mixer()->GetVolumePercent()); | 172 EXPECT_DOUBLE_EQ(0.0, audio_mixer()->GetVolumePercent()); |
| 146 | 173 |
| 147 // Thus, further VolumeUp doesn't recover the volume, it's just slightly | 174 // Thus, further VolumeUp doesn't recover the volume, it's just slightly |
| 148 // bigger than 0. | 175 // bigger than 0. |
| 149 VolumeUp(); | 176 VolumeUp(); |
| 150 EXPECT_LT(0.0, audio_mixer()->GetVolumePercent()); | 177 EXPECT_LT(0.0, audio_mixer()->GetVolumePercent()); |
| 151 EXPECT_GT(initial_volume, audio_mixer()->GetVolumePercent()); | 178 EXPECT_GT(initial_volume, audio_mixer()->GetVolumePercent()); |
| 152 } | 179 } |
| 153 | 180 |
| 154 } // namespace | 181 } // namespace |
| OLD | NEW |