summaryrefslogtreecommitdiffstats
path: root/chromeos/audio/audio_devices_pref_handler_stub.h
blob: 508cd270f575bf0423f0569cac8e73c57d5340f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2013 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 CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_
#define CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_

#include <stdint.h>

#include <map>

#include "base/macros.h"
#include "chromeos/audio/audio_devices_pref_handler.h"

namespace chromeos {

// Stub class for AudioDevicesPrefHandler, used for testing.
class CHROMEOS_EXPORT AudioDevicesPrefHandlerStub
    : public AudioDevicesPrefHandler {
 public:
  using AudioDeviceMute = std::map<uint64_t, bool>;
  using AudioDeviceVolumeGain = std::map<uint64_t, int>;
  using AudioDeviceLastState = std::map<uint64_t, AudioDeviceState>;

  AudioDevicesPrefHandlerStub();

  // AudioDevicesPrefHandler:
  double GetOutputVolumeValue(const AudioDevice* device) override;
  double GetInputGainValue(const AudioDevice* device) override;
  void SetVolumeGainValue(const AudioDevice& device, double value) override;
  bool GetMuteValue(const AudioDevice& device) override;
  void SetMuteValue(const AudioDevice& device, bool mute_on) override;
  AudioDeviceState GetDeviceState(const AudioDevice& device) override;
  void SetDeviceState(const AudioDevice& device,
                      AudioDeviceState state) override;
  bool GetAudioOutputAllowedValue() override;
  void AddAudioPrefObserver(AudioPrefObserver* observer) override;
  void RemoveAudioPrefObserver(AudioPrefObserver* observer) override;

 protected:
  ~AudioDevicesPrefHandlerStub() override;

 private:
  AudioDeviceMute audio_device_mute_map_;
  AudioDeviceVolumeGain audio_device_volume_gain_map_;
  AudioDeviceLastState audio_device_state_map_;

  DISALLOW_COPY_AND_ASSIGN(AudioDevicesPrefHandlerStub);
};

}  // namespace chromeos

#endif  // CHROMEOS_AUDIO_AUDIO_DEVICES_PREF_HANDLER_STUB_H_