Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: chromeos/dbus/fake_cras_audio_client.h

Issue 2087803003: Sync volume state using cras signal OutputNodeVolumeChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/audio/cras_audio_handler_unittest.cc ('k') | chromeos/dbus/fake_cras_audio_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Removes an AudioNode from |node_list_| based on |node_id|. 53 // Removes an AudioNode from |node_list_| based on |node_id|.
54 void RemoveAudioNodeFromList(const uint64_t& node_id); 54 void RemoveAudioNodeFromList(const uint64_t& node_id);
55 55
56 // Updates |node_list_| to contain |audio_nodes|. 56 // Updates |node_list_| to contain |audio_nodes|.
57 void SetAudioNodesForTesting(const AudioNodeList& audio_nodes); 57 void SetAudioNodesForTesting(const AudioNodeList& audio_nodes);
58 58
59 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|. 59 // Calls SetAudioNodesForTesting() and additionally notifies |observers_|.
60 void SetAudioNodesAndNotifyObserversForTesting( 60 void SetAudioNodesAndNotifyObserversForTesting(
61 const AudioNodeList& new_nodes); 61 const AudioNodeList& new_nodes);
62 62
63 // Generates fake signal for OutputNodeVolumeChanged.
64 void NotifyOutputNodeVolumeChangedForTesting(uint64_t node_id, int volume);
65
63 const AudioNodeList& node_list() const { return node_list_; } 66 const AudioNodeList& node_list() const { return node_list_; }
64 const uint64_t& active_input_node_id() const { return active_input_node_id_; } 67 const uint64_t& active_input_node_id() const { return active_input_node_id_; }
65 const uint64_t& active_output_node_id() const { 68 const uint64_t& active_output_node_id() const {
66 return active_output_node_id_; 69 return active_output_node_id_;
67 } 70 }
71 void set_notify_volume_change_with_delay(bool notify_with_delay) {
72 notify_volume_change_with_delay_ = notify_with_delay;
73 }
68 74
69 private: 75 private:
70 // Find a node in the list based on the id. 76 // Finds a node in the list based on the id.
71 AudioNodeList::iterator FindNode(uint64_t node_id); 77 AudioNodeList::iterator FindNode(uint64_t node_id);
72 78
73 VolumeState volume_state_; 79 VolumeState volume_state_;
74 AudioNodeList node_list_; 80 AudioNodeList node_list_;
75 uint64_t active_input_node_id_; 81 uint64_t active_input_node_id_;
76 uint64_t active_output_node_id_; 82 uint64_t active_output_node_id_;
83 // By default, immediately sends OutputNodeVolumeChange signal following the
84 // SetOutputNodeVolume fake dbus call.
85 bool notify_volume_change_with_delay_ = false;
77 base::ObserverList<Observer> observers_; 86 base::ObserverList<Observer> observers_;
78 87
79 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient); 88 DISALLOW_COPY_AND_ASSIGN(FakeCrasAudioClient);
80 }; 89 };
81 90
82 } // namespace chromeos 91 } // namespace chromeos
83 92
84 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_ 93 #endif // CHROMEOS_DBUS_FAKE_CRAS_AUDIO_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/audio/cras_audio_handler_unittest.cc ('k') | chromeos/dbus/fake_cras_audio_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698