| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
std::array<GoogleServiceAuthError, 10> errors = {nit: it's better to avoid hardcoding the size of statically defined arrays:
```suggestion
auto errors = std::to_array<GoogleServiceAuthError>({
```
// Construct a REQUEST_CANCELEDACCOUNT_NOT_FOUND error.nit: Something went wrong here:
```suggestion
// Construct a REQUEST_CANCELED error.
```
static GoogleServiceAuthError AuthErrorAccountNotFound();optional naming bikeshed: this naming scheme is consistent with `AuthErrorNone()` but I'm not sure this is the best option
`GoogleServiceAuthError::AuthErrorAccountNotFound()` is a bit too repetitive. How about `GoogleServiceAuthError::CreateAccountNotFound()`?
e.g. for `CreateRequestCanceled()` and `CreateNone()` (can be renamed in the future)
alternatively, we could have `GoogleServiceAuthError::AccountNotFound()`, `GoogleServiceAuthError::RequestCanceled()`, `GoogleServiceAuthError::None()`
// Construct a ACCOUNT_NOT_FOUND error.nit:
```suggestion
// Construct an ACCOUNT_NOT_FOUND error.
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
nit: it's better to avoid hardcoding the size of statically defined arrays:
```suggestion
auto errors = std::to_array<GoogleServiceAuthError>({
```
Done
nit: Something went wrong here:
```suggestion
// Construct a REQUEST_CANCELED error.
```
Done
optional naming bikeshed: this naming scheme is consistent with `AuthErrorNone()` but I'm not sure this is the best option
`GoogleServiceAuthError::AuthErrorAccountNotFound()` is a bit too repetitive. How about `GoogleServiceAuthError::CreateAccountNotFound()`?
e.g. for `CreateRequestCanceled()` and `CreateNone()` (can be renamed in the future)
alternatively, we could have `GoogleServiceAuthError::AccountNotFound()`, `GoogleServiceAuthError::RequestCanceled()`, `GoogleServiceAuthError::None()`
Done
nit:
```suggestion
// Construct an ACCOUNT_NOT_FOUND error.
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
LGTM, thanks!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Hey could you please take a look at this cl before I send it out for owner's approval?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
@fleimgruber Could you ptal at this cl? Thank you :)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
Thank you both for the fast review!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Could you please take a look at this cl too? Thank you!
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
auto expected_error =
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason::
CREDENTIALS_REJECTED_BY_CLIENT);
EXPECT_EQ(error.state(), expected_error.state());
EXPECT_EQ(error.GetInvalidGaiaCredentialsReason(),
expected_error.GetInvalidGaiaCredentialsReason());I don't think this part of the code should be changed. We're not creating an error from a state here.
Lines `1014` and `1056` in this file need to be changed as we're creating error there.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
auto expected_error =
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason::
CREDENTIALS_REJECTED_BY_CLIENT);
EXPECT_EQ(error.state(), expected_error.state());
EXPECT_EQ(error.GetInvalidGaiaCredentialsReason(),
expected_error.GetInvalidGaiaCredentialsReason());I don't think this part of the code should be changed. We're not creating an error from a state here.
Lines `1014` and `1056` in this file need to be changed as we're creating error there.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
auto expected_error =
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason::
CREDENTIALS_REJECTED_BY_CLIENT);
EXPECT_EQ(error.state(), expected_error.state());
EXPECT_EQ(error.GetInvalidGaiaCredentialsReason(),
expected_error.GetInvalidGaiaCredentialsReason());Liza BipinI don't think this part of the code should be changed. We're not creating an error from a state here.
Lines `1014` and `1056` in this file need to be changed as we're creating error there.
smh yeah not sure how i missed that, Done.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
auto expected_error =
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason::
CREDENTIALS_REJECTED_BY_CLIENT);
EXPECT_EQ(error.state(), expected_error.state());
EXPECT_EQ(error.GetInvalidGaiaCredentialsReason(),
expected_error.GetInvalidGaiaCredentialsReason());Liza BipinI don't think this part of the code should be changed. We're not creating an error from a state here.
Lines `1014` and `1056` in this file need to be changed as we're creating error there.
Tanmoy Molliksmh yeah not sure how i missed that, Done.
There is another usage left at line 1056
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
GoogleServiceAuthError::FromServiceUnavailable(std::string()));nit: you can use `""` here.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
GoogleServiceAuthError::FromServiceUnavailable(std::string()));nit: you can use `""` here.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
5 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: chrome/browser/signin/dice_response_handler_unittest.cc
Insertions: 1, Deletions: 1.
The diff is too large to show. Please review the diff.
```
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Thanks! -> droger@
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Reviewer source(s):
tr...@chromium.org is from context(googleclient/chrome/chromium_gwsq/components/sync/config.gwsq)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
GoogleServiceAuthError::FromServiceUnavailable(""));`/*error_message=*/std::string()`
GoogleServiceAuthError::InvalidGaiaCredentialsReason::UNKNOWN));optional: I think `CREDENTIALS_REJECTED_BY_CLIENT` would make sense here. Same for the other instances in this file.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
GoogleServiceAuthError::FromServiceUnavailable(""));Tanmoy Mollik`/*error_message=*/std::string()`
Done
GoogleServiceAuthError::InvalidGaiaCredentialsReason::UNKNOWN));optional: I think `CREDENTIALS_REJECTED_BY_CLIENT` would make sense here. Same for the other instances in this file.
Done
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: components/sync/service/sync_service_impl_unittest.cc
Insertions: 9, Deletions: 5.
The diff is too large to show. Please review the diff.
```
```
The name of the file: components/sync/service/device_statistics_request_impl_unittest.cc
Insertions: 2, Deletions: 1.
The diff is too large to show. Please review the diff.
```
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Reviewer source(s):
dd...@google.com is from context(googleclient/chrome/chromium_gwsq/chrome/browser/supervised_user/config.gwsq)
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Auto-Submit | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
// Contains all non-deprecated Google service auth errors.
const GoogleServiceAuthError table[] = {
GoogleServiceAuthError::AuthErrorNone(),
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason::UNKNOWN),
GoogleServiceAuthError::CreateAccountNotFound(),
GoogleServiceAuthError::FromConnectionError(net::ERR_FAILED),
GoogleServiceAuthError::FromServiceUnavailable(std::string()),
GoogleServiceAuthError::CreateRequestCanceled(),
GoogleServiceAuthError::FromUnexpectedServiceResponse(std::string()),
GoogleServiceAuthError::FromServiceError(std::string()),
GoogleServiceAuthError::FromScopeLimitedUnrecoverableErrorReason(
GoogleServiceAuthError::ScopeLimitedUnrecoverableErrorReason::
kInvalidScope),
GoogleServiceAuthError::FromTokenBindingChallenge(std::string()),
GoogleServiceAuthError::FromDeviceManagementError(
std::make_unique<gaia::FakeDeviceManagementErrorDetails>()),
};It's forbidden to have static objects that don't have a trivial destructor.
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
Consider either making `table` a test fixture class member or wrapping it in a function like the following:
```
std::vector<GoogleServiceAuthError> GetAllErrors() {
return {
GoogleServiceAuthError::AuthErrorNone(),
// ...
};
}
```
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
// Contains all non-deprecated Google service auth errors.
const GoogleServiceAuthError table[] = {
GoogleServiceAuthError::AuthErrorNone(),
GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
GoogleServiceAuthError::InvalidGaiaCredentialsReason::UNKNOWN),
GoogleServiceAuthError::CreateAccountNotFound(),
GoogleServiceAuthError::FromConnectionError(net::ERR_FAILED),
GoogleServiceAuthError::FromServiceUnavailable(std::string()),
GoogleServiceAuthError::CreateRequestCanceled(),
GoogleServiceAuthError::FromUnexpectedServiceResponse(std::string()),
GoogleServiceAuthError::FromServiceError(std::string()),
GoogleServiceAuthError::FromScopeLimitedUnrecoverableErrorReason(
GoogleServiceAuthError::ScopeLimitedUnrecoverableErrorReason::
kInvalidScope),
GoogleServiceAuthError::FromTokenBindingChallenge(std::string()),
GoogleServiceAuthError::FromDeviceManagementError(
std::make_unique<gaia::FakeDeviceManagementErrorDetails>()),
};It's forbidden to have static objects that don't have a trivial destructor.
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables
Consider either making `table` a test fixture class member or wrapping it in a function like the following:
```
std::vector<GoogleServiceAuthError> GetAllErrors() {
return {
GoogleServiceAuthError::AuthErrorNone(),
// ...
};
}
```
I had to add some extra code to be able to do the `static_assert` check.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Commit-Queue | +2 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
2 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_unittest.cc
Insertions: 28, Deletions: 29.
@@ -81,35 +81,39 @@
}
// Contains all non-deprecated Google service auth errors.
-const GoogleServiceAuthError table[] = {
- GoogleServiceAuthError::AuthErrorNone(),
- GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
- GoogleServiceAuthError::InvalidGaiaCredentialsReason::UNKNOWN),
- GoogleServiceAuthError::CreateAccountNotFound(),
- GoogleServiceAuthError::FromConnectionError(net::ERR_FAILED),
- GoogleServiceAuthError::FromServiceUnavailable(std::string()),
- GoogleServiceAuthError::CreateRequestCanceled(),
- GoogleServiceAuthError::FromUnexpectedServiceResponse(std::string()),
- GoogleServiceAuthError::FromServiceError(std::string()),
- GoogleServiceAuthError::FromScopeLimitedUnrecoverableErrorReason(
- GoogleServiceAuthError::ScopeLimitedUnrecoverableErrorReason::
- kInvalidScope),
- GoogleServiceAuthError::FromTokenBindingChallenge(std::string()),
- GoogleServiceAuthError::FromDeviceManagementError(
- std::make_unique<gaia::FakeDeviceManagementErrorDetails>()),
-};
+std::vector<GoogleServiceAuthError> GetAllErrors() {
+ const GoogleServiceAuthError table[] = {
+ GoogleServiceAuthError::AuthErrorNone(),
+ GoogleServiceAuthError::FromInvalidGaiaCredentialsReason(
+ GoogleServiceAuthError::InvalidGaiaCredentialsReason::UNKNOWN),
+ GoogleServiceAuthError::CreateAccountNotFound(),
+ GoogleServiceAuthError::FromConnectionError(net::ERR_FAILED),
+ GoogleServiceAuthError::FromServiceUnavailable(std::string()),
+ GoogleServiceAuthError::CreateRequestCanceled(),
+ GoogleServiceAuthError::FromUnexpectedServiceResponse(std::string()),
+ GoogleServiceAuthError::FromServiceError(std::string()),
+ GoogleServiceAuthError::FromScopeLimitedUnrecoverableErrorReason(
+ GoogleServiceAuthError::ScopeLimitedUnrecoverableErrorReason::
+ kInvalidScope),
+ GoogleServiceAuthError::FromTokenBindingChallenge(std::string()),
+ GoogleServiceAuthError::FromDeviceManagementError(
+ std::make_unique<gaia::FakeDeviceManagementErrorDetails>()),
+ };
+ static_assert(
+ std::size(table) == GoogleServiceAuthError::NUM_STATES -
+ GoogleServiceAuthError::kDeprecatedStateCount,
+ "table size should match number of auth error types");
+
+ return std::vector<GoogleServiceAuthError>(std::begin(table),
+ std::end(table));
+}
TEST_F(ProfileOAuth2TokenServiceDelegateTest, UpdateAuthErrorPersistenErrors) {
const CoreAccountId account_id =
CoreAccountId::FromGaiaId(GaiaId("account_id"));
delegate.UpdateCredentials(account_id, "refresh_token");
- static_assert(
- std::size(table) == GoogleServiceAuthError::NUM_STATES -
- GoogleServiceAuthError::kDeprecatedStateCount,
- "table size should match number of auth error types");
-
- for (const auto& error : table) {
+ for (const auto& error : GetAllErrors()) {
if (!error.IsPersistentError() || error.IsScopePersistentError()) {
continue;
}
@@ -133,14 +137,9 @@
CoreAccountId::FromGaiaId(GaiaId("account_id"));
delegate.UpdateCredentials(account_id, "refresh_token");
- static_assert(
- std::size(table) == GoogleServiceAuthError::NUM_STATES -
- GoogleServiceAuthError::kDeprecatedStateCount,
- "table size should match number of auth error types");
-
EXPECT_TRUE(delegate.BackoffEntry());
int failure_count = 0;
- for (const auto& error : table) {
+ for (const auto& error : GetAllErrors()) {
if (!error.IsTransientError()) {
continue;
}
```
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
[google_apis] Use factory method to create GoogleServiceAuthError
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |