Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_TEST_VOLUME_CONTROL_DELEGATE_STUB_H_ | |
| 6 #define ASH_TEST_VOLUME_CONTROL_DELEGATE_STUB_H_ | |
| 7 | |
| 8 #include "ash/volume_control_delegate.h" | |
| 9 #include "ui/base/accelerators/accelerator.h" | |
| 10 | |
| 11 namespace ash { | |
| 12 | |
| 13 // A simple TestDouble for a VolumeControlDelegate | |
|
flackr
2014/04/30 14:27:44
TestDouble?
bruthig
2014/04/30 15:36:16
"A test double is an object that can stand in for
flackr
2014/04/30 15:43:10
Ah okay, I hadn't heard the term before and the Ti
| |
| 14 // Will count the number of times the HandleVolumeMute, HandleVolumeDown and | |
| 15 // HandleVolumeUp methods are invoked and will return a predefined value from | |
| 16 // these methods. The predefined value is defined upon construction. | |
|
flackr
2014/04/30 14:27:44
No need to mention the predefined consume value. h
bruthig
2014/04/30 15:36:16
Done.
| |
| 17 class VolumeControlDelegateStub : public ash::VolumeControlDelegate { | |
|
flackr
2014/04/30 14:27:44
For consistency, it looks like the other mock impl
bruthig
2014/04/30 15:36:16
For consistency I've renamed it to TestVolumeContr
bruthig
2014/04/30 15:36:16
Done.
| |
| 18 public: | |
| 19 explicit VolumeControlDelegateStub(bool consume); | |
| 20 virtual ~VolumeControlDelegateStub(); | |
| 21 | |
| 22 int handle_volume_mute_count() const { | |
| 23 return handle_volume_mute_count_; | |
| 24 } | |
| 25 | |
| 26 int handle_volume_down_count() const { | |
| 27 return handle_volume_down_count_; | |
| 28 } | |
| 29 | |
| 30 int handle_volume_up_count() const { | |
| 31 return handle_volume_up_count_; | |
| 32 } | |
| 33 | |
| 34 const ui::Accelerator& last_accelerator() const { | |
| 35 return last_accelerator_; | |
| 36 } | |
| 37 | |
| 38 // ash::VolumeControlDelegate: | |
| 39 virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE; | |
| 40 virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE; | |
| 41 virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE; | |
| 42 | |
| 43 private: | |
| 44 bool consume_; | |
|
flackr
2014/04/30 14:27:44
Can comment what consume means here instead.
bruthig
2014/04/30 15:36:16
Done.
| |
| 45 int handle_volume_mute_count_; | |
| 46 int handle_volume_down_count_; | |
| 47 int handle_volume_up_count_; | |
| 48 ui::Accelerator last_accelerator_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(VolumeControlDelegateStub); | |
| 51 }; | |
| 52 | |
| 53 } // namespace ash | |
| 54 | |
| 55 #endif // ASH_TEST_VOLUME_CONTROL_DELEGATE_STUB_H_ | |
| OLD | NEW |