summaryrefslogtreecommitdiffstats
path: root/ash/test/test_volume_control_delegate.h
diff options
context:
space:
mode:
authorbruthig@chromium.org <bruthig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 15:15:51 +0000
committerbruthig@chromium.org <bruthig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-09 15:15:51 +0000
commit6b140e760777135e9326c24bbb02f6592cf57201 (patch)
tree8962f2a556ec95c7c30d8cd31aac16e41bb420c0 /ash/test/test_volume_control_delegate.h
parent3dc81f218677e2468be0c09215b1eeedf1e35eba (diff)
downloadchromium_src-6b140e760777135e9326c24bbb02f6592cf57201.zip
chromium_src-6b140e760777135e9326c24bbb02f6592cf57201.tar.gz
chromium_src-6b140e760777135e9326c24bbb02f6592cf57201.tar.bz2
Relanding "Enabled volume buttons when TouchView is active"
Original review: https://codereview.chromium.org/251193005 This reverts commit 680db8794d3159acfc6354e7a4ce46a6abf4dac4. BUG=364584 TEST=MaximizeCodeControllerTest.AllowsVolumeControl TBR=oshima Review URL: https://codereview.chromium.org/271713002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269306 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test/test_volume_control_delegate.h')
-rw-r--r--ash/test/test_volume_control_delegate.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/ash/test/test_volume_control_delegate.h b/ash/test/test_volume_control_delegate.h
new file mode 100644
index 0000000..85b3e5d
--- /dev/null
+++ b/ash/test/test_volume_control_delegate.h
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ASH_TEST_TEST_VOLUME_CONTROL_DELEGATE_H_
+#define ASH_TEST_TEST_VOLUME_CONTROL_DELEGATE_H_
+
+#include "ash/volume_control_delegate.h"
+#include "ui/base/accelerators/accelerator.h"
+
+namespace ash {
+
+// A simple test double for a VolumeControlDelegate
+// Will count the number of times the HandleVolumeMute, HandleVolumeDown and
+// HandleVolumeUp methods are invoked.
+class TestVolumeControlDelegate : public ash::VolumeControlDelegate {
+ public:
+ explicit TestVolumeControlDelegate(bool consume);
+ virtual ~TestVolumeControlDelegate();
+
+ int handle_volume_mute_count() const {
+ return handle_volume_mute_count_;
+ }
+
+ int handle_volume_down_count() const {
+ return handle_volume_down_count_;
+ }
+
+ int handle_volume_up_count() const {
+ return handle_volume_up_count_;
+ }
+
+ const ui::Accelerator& last_accelerator() const {
+ return last_accelerator_;
+ }
+
+ // ash::VolumeControlDelegate:
+ virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE;
+ virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE;
+ virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE;
+
+ private:
+ // Keeps track of the return value that should be used for the methods
+ // inherited from VolumeControlDelegate
+ bool consume_;
+ int handle_volume_mute_count_;
+ int handle_volume_down_count_;
+ int handle_volume_up_count_;
+ ui::Accelerator last_accelerator_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestVolumeControlDelegate);
+};
+
+} // namespace ash
+
+#endif // ASH_TEST_TEST_VOLUME_CONTROL_DELEGATE_H_