0

[CodeHealth] Remove deprecated SetDictionary from FakeGaia

Removes deprecated DictionaryValue and SetDictionary usages from
FakeGaia and replaces them with base::Value and SetKey.

Bug: 1187029
Change-Id: I4bf043f26b9c438c057fc77df149b69f38fa11e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3353858
Reviewed-by: Mihai Sardarescu <msarda@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#954321}
This commit is contained in:
Alex Cooper
2021-12-28 18:38:46 +00:00
committed by Chromium LUCI CQ
parent d5fbff8714
commit 36bac8568d

@@ -978,42 +978,41 @@ void FakeGaia::HandleGetCheckConnectionInfo(const HttpRequest& request,
void FakeGaia::HandleGetReAuthProofToken(const HttpRequest& request,
BasicHttpResponse* http_response) {
base::DictionaryValue response_dict;
std::unique_ptr<base::DictionaryValue> error =
std::make_unique<base::DictionaryValue>();
base::Value response_dict(base::Value::Type::DICTIONARY);
base::Value error(base::Value::Type::DICTIONARY);
switch (next_reauth_status_) {
case GaiaAuthConsumer::ReAuthProofTokenStatus::kSuccess:
response_dict.SetString("encodedRapt", "abc123");
response_dict.SetStringKey("encodedRapt", "abc123");
FormatOkJSONResponse(response_dict, http_response);
break;
case GaiaAuthConsumer::ReAuthProofTokenStatus::kInvalidGrant:
error->SetString("message", "INVALID_GRANT");
response_dict.SetDictionary("error", std::move(error));
error.SetStringKey("message", "INVALID_GRANT");
response_dict.SetKey("error", std::move(error));
FormatJSONResponse(response_dict, net::HTTP_BAD_REQUEST, http_response);
break;
case GaiaAuthConsumer::ReAuthProofTokenStatus::kInvalidRequest:
error->SetString("message", "INVALID_REQUEST");
response_dict.SetDictionary("error", std::move(error));
error.SetStringKey("message", "INVALID_REQUEST");
response_dict.SetKey("error", std::move(error));
FormatJSONResponse(response_dict, net::HTTP_BAD_REQUEST, http_response);
break;
case GaiaAuthConsumer::ReAuthProofTokenStatus::kUnauthorizedClient:
error->SetString("message", "UNAUTHORIZED_CLIENT");
response_dict.SetDictionary("error", std::move(error));
error.SetStringKey("message", "UNAUTHORIZED_CLIENT");
response_dict.SetKey("error", std::move(error));
FormatJSONResponse(response_dict, net::HTTP_FORBIDDEN, http_response);
break;
case GaiaAuthConsumer::ReAuthProofTokenStatus::kInsufficientScope:
error->SetString("message", "INSUFFICIENT_SCOPE");
response_dict.SetDictionary("error", std::move(error));
error.SetStringKey("message", "INSUFFICIENT_SCOPE");
response_dict.SetKey("error", std::move(error));
FormatJSONResponse(response_dict, net::HTTP_FORBIDDEN, http_response);
break;
case GaiaAuthConsumer::ReAuthProofTokenStatus::kCredentialNotSet:
response_dict.SetDictionary("error", std::move(error));
response_dict.SetKey("error", std::move(error));
FormatJSONResponse(response_dict, net::HTTP_FORBIDDEN, http_response);
break;