Skip to content

Commit

Permalink
[CodeHealth] Remove deprecated SetDictionary from FakeGaia
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
alcooper91 authored and Chromium LUCI CQ committed Dec 28, 2021
1 parent d5fbff8 commit 36bac85
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions google_apis/gaia/fake_gaia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 36bac85

Please sign in to comment.