From e7863010ce2cb99beeb5ad15d2490076c3538c95 Mon Sep 17 00:00:00 2001 From: Brian Ting Date: Wed, 29 May 2024 14:20:15 -0700 Subject: [PATCH] Fix not returning WindowId when valid. b/342003753 --- cobalt/webdriver/protocol/window_id.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cobalt/webdriver/protocol/window_id.cc b/cobalt/webdriver/protocol/window_id.cc index b63667956cbb..179f724c8968 100644 --- a/cobalt/webdriver/protocol/window_id.cc +++ b/cobalt/webdriver/protocol/window_id.cc @@ -23,8 +23,11 @@ const char kWindowNameKey[] = "name"; base::Optional WindowId::FromValue(const base::Value* value) { const base::Value::Dict* dictionary_value = value->GetIfDict(); - if (!dictionary_value) { - return absl::nullopt; + if (dictionary_value) { + const std::string* window_id = dictionary_value->FindString(kWindowNameKey); + if (window_id) { + return WindowId(*window_id); + } } return base::nullopt; }