Skip to content

Commit

Permalink
audio_diagnostics: Include input/output recent activated JSON
Browse files Browse the repository at this point in the history
BUG=b:365985920
TEST=cargo test --workspace -- --nocapture

Change-Id: Id57261ac55990e190542ef9462e9a939a0c811a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5873425
Tested-by: chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com <chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com>
Commit-Queue: Gavin Williams <gavinwill@chromium.org>
Reviewed-by: Li-Yu Yu <aaronyu@google.com>
Reviewed-by: Wenyu Zhang <zhangwenyu@google.com>
  • Loading branch information
Gavin Williams authored and Chromeos LUCI committed Sep 24, 2024
1 parent 1d2d648 commit e32341a
Showing 1 changed file with 49 additions and 1 deletion.
50 changes: 49 additions & 1 deletion cras/client/audio_diagnostics/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ struct Audio {
output_user_priority: Option<HashMap<AudioNode, i32>>,
input_preference_set: Option<HashMap<AudioNodeSet, AudioNode>>,
output_preference_set: Option<HashMap<AudioNodeSet, AudioNode>>,
most_recent_activated_input_device_ids: Option<Vec<AudioNode>>,
most_recent_activated_output_device_ids: Option<Vec<AudioNode>>,
// The last_seen field is intentionally dropped to avoid
// joining feedback reports. See b/279545748#comment11.
}
Expand Down Expand Up @@ -326,7 +328,13 @@ mod tests {
},
"output_preference_set": {
"2356475750 : 0, 1923447123 : 0, 2315562897 : 0": "1923447123 : 0"
}
},
"most_recent_activated_input_device_ids": [
"3787040 : 1", "2315562897 : 1", "3962083865 : 1"
],
"most_recent_activated_output_device_ids": [
"2356475750 : 0", "1923447123 : 0", "2315562897 : 0"
]
}"#;
let local_state_string = r#"{"settings":{"audio":@AUDIO_SETTINGS@}}"#
.replace("@AUDIO_SETTINGS@", audio_settings_str);
Expand Down Expand Up @@ -487,5 +495,45 @@ mod tests {
is_input: false
}
);
assert_eq!(
*audio
.most_recent_activated_input_device_ids
.as_ref()
.unwrap(),
vec![
AudioNode {
stable_id: 3787040,
is_input: true,
},
AudioNode {
stable_id: 2315562897,
is_input: true,
},
AudioNode {
stable_id: 3962083865,
is_input: true,
},
]
);
assert_eq!(
*audio
.most_recent_activated_output_device_ids
.as_ref()
.unwrap(),
vec![
AudioNode {
stable_id: 2356475750,
is_input: false,
},
AudioNode {
stable_id: 1923447123,
is_input: false,
},
AudioNode {
stable_id: 2315562897,
is_input: false,
},
]
);
}
}

0 comments on commit e32341a

Please sign in to comment.