Commit ab8d3f1f authored by Josh Nohle's avatar Josh Nohle Committed by Commit Bot

[DeviceSync v2] Fix CryptAuthDeviceSyncResult equality operator

Add a comparison for did_device_registry_change_.

Also, simplified the function by extracting the ClientDirective
comparison and simplifying that logic.

Bug: 951969
Change-Id: I61809ed953e711502c3a058c51cc1315888e8e20
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1747376
Commit-Queue: Josh Nohle <nohle@chromium.org>
Auto-Submit: Josh Nohle <nohle@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686097}
parent 8b3ca41c
......@@ -45,11 +45,14 @@ bool CryptAuthDeviceSyncResult::IsSuccess() const {
bool CryptAuthDeviceSyncResult::operator==(
const CryptAuthDeviceSyncResult& other) const {
return result_code_ == other.result_code_ &&
client_directive_.has_value() == other.client_directive_.has_value() &&
(!client_directive_ ||
client_directive_->SerializeAsString() ==
other.client_directive_->SerializeAsString());
bool client_directives_agree =
(!client_directive_.has_value() &&
!other.client_directive_.has_value()) ||
(client_directive_.has_value() && other.client_directive_.has_value() &&
client_directive_->SerializeAsString() ==
other.client_directive_->SerializeAsString());
return client_directives_agree && result_code_ == other.result_code_ &&
did_device_registry_change_ == other.did_device_registry_change_;
}
bool CryptAuthDeviceSyncResult::operator!=(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment