Commit ce6cab7c authored by Muhammad Hasan Khan's avatar Muhammad Hasan Khan Committed by Chromium LUCI CQ

arc: Rename provisioning result structs

Sign-in and check-in are both from GMS so fixing the naming.

BUG=b:166322619
TEST=CQ

Change-Id: I4c3173448d06488b0c4a98fb5825207e7724d1eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2558762
Commit-Queue: Muhammad Hasan Khan <mhasank@chromium.org>
Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Reviewed-by: default avatarHidehiko Abe <hidehiko@chromium.org>
Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832161}
parent a27d1bf5
...@@ -214,7 +214,7 @@ ProvisioningResultUMA GetProvisioningResultUMA( ...@@ -214,7 +214,7 @@ ProvisioningResultUMA GetProvisioningResultUMA(
if (provisioning_result.is_timedout()) if (provisioning_result.is_timedout())
return ProvisioningResultUMA::OVERALL_SIGN_IN_TIMEOUT; return ProvisioningResultUMA::OVERALL_SIGN_IN_TIMEOUT;
const mojom::ArcSignInResult* result = provisioning_result.signin_result(); const mojom::ArcSignInResult* result = provisioning_result.sign_in_result();
if (result->is_success()) { if (result->is_success()) {
if (result->get_success() == mojom::ArcSignInSuccess::SUCCESS) if (result->get_success() == mojom::ArcSignInSuccess::SUCCESS)
return ProvisioningResultUMA::SUCCESS; return ProvisioningResultUMA::SUCCESS;
...@@ -233,7 +233,7 @@ ProvisioningResultUMA GetProvisioningResultUMA( ...@@ -233,7 +233,7 @@ ProvisioningResultUMA GetProvisioningResultUMA(
switch (result->get_error()->get_general_error()) { switch (result->get_error()->get_general_error()) {
MAP_GENERAL_ERROR(UNKNOWN_ERROR); MAP_GENERAL_ERROR(UNKNOWN_ERROR);
MAP_GENERAL_ERROR(MOJO_VERSION_MISMATCH); MAP_GENERAL_ERROR(MOJO_VERSION_MISMATCH);
MAP_GENERAL_ERROR(PROVISIONING_TIMEOUT); MAP_GENERAL_ERROR(GENERIC_PROVISIONING_TIMEOUT);
MAP_GENERAL_ERROR(NO_NETWORK_CONNECTION); MAP_GENERAL_ERROR(NO_NETWORK_CONNECTION);
MAP_GENERAL_ERROR(CHROME_SERVER_COMMUNICATION_ERROR); MAP_GENERAL_ERROR(CHROME_SERVER_COMMUNICATION_ERROR);
MAP_GENERAL_ERROR(ARC_DISABLED); MAP_GENERAL_ERROR(ARC_DISABLED);
...@@ -243,28 +243,28 @@ ProvisioningResultUMA GetProvisioningResultUMA( ...@@ -243,28 +243,28 @@ ProvisioningResultUMA GetProvisioningResultUMA(
#undef MAP_GENERAL_ERROR #undef MAP_GENERAL_ERROR
} }
if (result->get_error()->is_checkin_error()) { if (result->get_error()->is_check_in_error()) {
#define MAP_CHECKIN_ERROR(name) \ #define MAP_CHECKIN_ERROR(name) \
case mojom::DeviceCheckInError::name: \ case mojom::GMSCheckInError::name: \
return ProvisioningResultUMA::name return ProvisioningResultUMA::name
switch (result->get_error()->get_checkin_error()) { switch (result->get_error()->get_check_in_error()) {
MAP_CHECKIN_ERROR(DEVICE_CHECK_IN_FAILED); MAP_CHECKIN_ERROR(GMS_CHECK_IN_FAILED);
MAP_CHECKIN_ERROR(DEVICE_CHECK_IN_TIMEOUT); MAP_CHECKIN_ERROR(GMS_CHECK_IN_TIMEOUT);
MAP_CHECKIN_ERROR(DEVICE_CHECK_IN_INTERNAL_ERROR); MAP_CHECKIN_ERROR(GMS_CHECK_IN_INTERNAL_ERROR);
} }
#undef MAP_CHECKIN_ERROR #undef MAP_CHECKIN_ERROR
} }
if (result->get_error()->is_gms_error()) { if (result->get_error()->is_sign_in_error()) {
#define MAP_GMS_ERROR(name) \ #define MAP_GMS_ERROR(name) \
case mojom::GMSError::name: \ case mojom::GMSSignInError::name: \
return ProvisioningResultUMA::name return ProvisioningResultUMA::name
switch (result->get_error()->get_gms_error()) { switch (result->get_error()->get_sign_in_error()) {
MAP_GMS_ERROR(GMS_NETWORK_ERROR); MAP_GMS_ERROR(GMS_SIGN_IN_NETWORK_ERROR);
MAP_GMS_ERROR(GMS_SERVICE_UNAVAILABLE); MAP_GMS_ERROR(GMS_SIGN_IN_SERVICE_UNAVAILABLE);
MAP_GMS_ERROR(GMS_BAD_AUTHENTICATION); MAP_GMS_ERROR(GMS_SIGN_IN_BAD_AUTHENTICATION);
MAP_GMS_ERROR(GMS_SIGN_IN_FAILED); MAP_GMS_ERROR(GMS_SIGN_IN_FAILED);
MAP_GMS_ERROR(GMS_SIGN_IN_TIMEOUT); MAP_GMS_ERROR(GMS_SIGN_IN_TIMEOUT);
MAP_GMS_ERROR(GMS_SIGN_IN_INTERNAL_ERROR); MAP_GMS_ERROR(GMS_SIGN_IN_INTERNAL_ERROR);
...@@ -285,14 +285,14 @@ std::ostream& operator<<(std::ostream& os, ...@@ -285,14 +285,14 @@ std::ostream& operator<<(std::ostream& os,
switch (result) { switch (result) {
MAP_PROVISIONING_RESULT(SUCCESS); MAP_PROVISIONING_RESULT(SUCCESS);
MAP_PROVISIONING_RESULT(UNKNOWN_ERROR); MAP_PROVISIONING_RESULT(UNKNOWN_ERROR);
MAP_PROVISIONING_RESULT(GMS_NETWORK_ERROR); MAP_PROVISIONING_RESULT(GMS_SIGN_IN_NETWORK_ERROR);
MAP_PROVISIONING_RESULT(GMS_SERVICE_UNAVAILABLE); MAP_PROVISIONING_RESULT(GMS_SIGN_IN_SERVICE_UNAVAILABLE);
MAP_PROVISIONING_RESULT(GMS_BAD_AUTHENTICATION); MAP_PROVISIONING_RESULT(GMS_SIGN_IN_BAD_AUTHENTICATION);
MAP_PROVISIONING_RESULT(DEVICE_CHECK_IN_FAILED); MAP_PROVISIONING_RESULT(GMS_CHECK_IN_FAILED);
MAP_PROVISIONING_RESULT(MOJO_VERSION_MISMATCH); MAP_PROVISIONING_RESULT(MOJO_VERSION_MISMATCH);
MAP_PROVISIONING_RESULT(PROVISIONING_TIMEOUT); MAP_PROVISIONING_RESULT(GENERIC_PROVISIONING_TIMEOUT);
MAP_PROVISIONING_RESULT(DEVICE_CHECK_IN_TIMEOUT); MAP_PROVISIONING_RESULT(GMS_CHECK_IN_TIMEOUT);
MAP_PROVISIONING_RESULT(DEVICE_CHECK_IN_INTERNAL_ERROR); MAP_PROVISIONING_RESULT(GMS_CHECK_IN_INTERNAL_ERROR);
MAP_PROVISIONING_RESULT(GMS_SIGN_IN_FAILED); MAP_PROVISIONING_RESULT(GMS_SIGN_IN_FAILED);
MAP_PROVISIONING_RESULT(GMS_SIGN_IN_TIMEOUT); MAP_PROVISIONING_RESULT(GMS_SIGN_IN_TIMEOUT);
MAP_PROVISIONING_RESULT(GMS_SIGN_IN_INTERNAL_ERROR); MAP_PROVISIONING_RESULT(GMS_SIGN_IN_INTERNAL_ERROR);
......
...@@ -114,22 +114,22 @@ enum class ProvisioningResultUMA : int { ...@@ -114,22 +114,22 @@ enum class ProvisioningResultUMA : int {
UNKNOWN_ERROR = 1, UNKNOWN_ERROR = 1,
// GMS errors. More errors defined below. // GMS errors. More errors defined below.
GMS_NETWORK_ERROR = 2, GMS_SIGN_IN_NETWORK_ERROR = 2,
GMS_SERVICE_UNAVAILABLE = 3, GMS_SIGN_IN_SERVICE_UNAVAILABLE = 3,
GMS_BAD_AUTHENTICATION = 4, GMS_SIGN_IN_BAD_AUTHENTICATION = 4,
// Check in error. More errors defined below. // Check in error. More errors defined below.
DEVICE_CHECK_IN_FAILED = 5, GMS_CHECK_IN_FAILED = 5,
// Mojo errors. // Mojo errors.
MOJO_VERSION_MISMATCH = 7, MOJO_VERSION_MISMATCH = 7,
// Misc // ARC did not finish provisioning within a reasonable amount of time.
PROVISIONING_TIMEOUT = 8, GENERIC_PROVISIONING_TIMEOUT = 8,
// Check in error. // Check in error.
DEVICE_CHECK_IN_TIMEOUT = 9, GMS_CHECK_IN_TIMEOUT = 9,
DEVICE_CHECK_IN_INTERNAL_ERROR = 10, GMS_CHECK_IN_INTERNAL_ERROR = 10,
// GMS errors: // GMS errors:
GMS_SIGN_IN_FAILED = 11, GMS_SIGN_IN_FAILED = 11,
......
...@@ -13,38 +13,38 @@ ArcProvisioningResult::ArcProvisioningResult(mojom::ArcSignInResultPtr result) ...@@ -13,38 +13,38 @@ ArcProvisioningResult::ArcProvisioningResult(mojom::ArcSignInResultPtr result)
: result_(std::move(result)) {} : result_(std::move(result)) {}
ArcProvisioningResult::ArcProvisioningResult(ArcStopReason reason) ArcProvisioningResult::ArcProvisioningResult(ArcStopReason reason)
: result_(reason) {} : result_(reason) {}
ArcProvisioningResult::ArcProvisioningResult(OverallSignInTimeout timeout) ArcProvisioningResult::ArcProvisioningResult(ChromeProvisioningTimeout timeout)
: result_(timeout) {} : result_(timeout) {}
ArcProvisioningResult::ArcProvisioningResult(ArcProvisioningResult&& other) = ArcProvisioningResult::ArcProvisioningResult(ArcProvisioningResult&& other) =
default; default;
ArcProvisioningResult::~ArcProvisioningResult() = default; ArcProvisioningResult::~ArcProvisioningResult() = default;
bool ArcProvisioningResult::has_signin_result() const { bool ArcProvisioningResult::has_sign_in_result() const {
return absl::holds_alternative<mojom::ArcSignInResultPtr>(result_); return absl::holds_alternative<mojom::ArcSignInResultPtr>(result_);
} }
const mojom::ArcSignInResult* ArcProvisioningResult::signin_result() const { const mojom::ArcSignInResult* ArcProvisioningResult::sign_in_result() const {
DCHECK(has_signin_result()); DCHECK(has_sign_in_result());
return absl::get<mojom::ArcSignInResultPtr>(result_).get(); return absl::get<mojom::ArcSignInResultPtr>(result_).get();
} }
bool ArcProvisioningResult::has_signin_error() const { bool ArcProvisioningResult::has_sign_in_error() const {
return has_signin_result() && signin_result()->is_error(); return has_sign_in_result() && sign_in_result()->is_error();
} }
const mojom::ArcSignInError* ArcProvisioningResult::signin_error() const { const mojom::ArcSignInError* ArcProvisioningResult::sign_in_error() const {
DCHECK(has_signin_error()); DCHECK(has_sign_in_error());
return signin_result()->get_error().get(); return sign_in_result()->get_error().get();
} }
bool ArcProvisioningResult::is_success() const { bool ArcProvisioningResult::is_success() const {
return has_signin_result() && signin_result()->is_success(); return has_sign_in_result() && sign_in_result()->is_success();
} }
bool ArcProvisioningResult::has_general_error( bool ArcProvisioningResult::has_general_error(
mojom::GeneralSignInError error) const { mojom::GeneralSignInError error) const {
return has_signin_error() && signin_error()->is_general_error() && return has_sign_in_error() && sign_in_error()->is_general_error() &&
signin_error()->get_general_error() == error; sign_in_error()->get_general_error() == error;
} }
bool ArcProvisioningResult::is_stopped() const { bool ArcProvisioningResult::is_stopped() const {
...@@ -57,7 +57,7 @@ ArcStopReason ArcProvisioningResult::stop_reason() const { ...@@ -57,7 +57,7 @@ ArcStopReason ArcProvisioningResult::stop_reason() const {
} }
bool ArcProvisioningResult::is_timedout() const { bool ArcProvisioningResult::is_timedout() const {
return absl::holds_alternative<OverallSignInTimeout>(result_); return absl::holds_alternative<ChromeProvisioningTimeout>(result_);
} }
std::ostream& operator<<(std::ostream& os, std::ostream& operator<<(std::ostream& os,
......
...@@ -16,28 +16,28 @@ enum class ProvisioningResultUMA : int; ...@@ -16,28 +16,28 @@ enum class ProvisioningResultUMA : int;
namespace arc { namespace arc {
// A struct that represents timeout of ARC provisioning from Chrome. // A struct that represents timeout of ARC provisioning from Chrome.
struct OverallSignInTimeout {}; struct ChromeProvisioningTimeout {};
// A class that encapsulates the result of provisioning ARC. // A class that encapsulates the result of provisioning ARC.
class ArcProvisioningResult { class ArcProvisioningResult {
public: public:
explicit ArcProvisioningResult(mojom::ArcSignInResultPtr result); explicit ArcProvisioningResult(mojom::ArcSignInResultPtr result);
explicit ArcProvisioningResult(ArcStopReason reason); explicit ArcProvisioningResult(ArcStopReason reason);
explicit ArcProvisioningResult(OverallSignInTimeout timeout); explicit ArcProvisioningResult(ChromeProvisioningTimeout timeout);
ArcProvisioningResult(ArcProvisioningResult&& other); ArcProvisioningResult(ArcProvisioningResult&& other);
~ArcProvisioningResult(); ~ArcProvisioningResult();
// Returns true if signin_result from ARC is present. // Returns true if signin_result from ARC is present.
bool has_signin_result() const; bool has_sign_in_result() const;
// Returns the result of provisioning from inside ARC. // Returns the result of provisioning from inside ARC.
const mojom::ArcSignInResult* signin_result() const; const mojom::ArcSignInResult* sign_in_result() const;
// Returns true if signin_result is present with an error. // Returns true if signin_result is present with an error.
bool has_signin_error() const; bool has_sign_in_error() const;
// Returns the error of signin_result coming from ARC. // Returns the error of signin_result coming from ARC.
const mojom::ArcSignInError* signin_error() const; const mojom::ArcSignInError* sign_in_error() const;
// Returns true if result has given general sign-in error. // Returns true if result has given general sign-in error.
bool has_general_error(mojom::GeneralSignInError error) const; bool has_general_error(mojom::GeneralSignInError error) const;
...@@ -55,7 +55,9 @@ class ArcProvisioningResult { ...@@ -55,7 +55,9 @@ class ArcProvisioningResult {
bool is_timedout() const; bool is_timedout() const;
private: private:
absl::variant<mojom::ArcSignInResultPtr, ArcStopReason, OverallSignInTimeout> absl::variant<mojom::ArcSignInResultPtr,
ArcStopReason,
ChromeProvisioningTimeout>
result_; result_;
}; };
......
...@@ -11,21 +11,21 @@ namespace arc { ...@@ -11,21 +11,21 @@ namespace arc {
TEST(ArcProvisioningResultTest, HasSignInResult) { TEST(ArcProvisioningResultTest, HasSignInResult) {
ArcProvisioningResult result1(ArcStopReason::CRASH); ArcProvisioningResult result1(ArcStopReason::CRASH);
EXPECT_FALSE(result1.has_signin_result()); EXPECT_FALSE(result1.has_sign_in_result());
ArcProvisioningResult result2(arc::mojom::ArcSignInResult::NewSuccess( ArcProvisioningResult result2(arc::mojom::ArcSignInResult::NewSuccess(
arc::mojom::ArcSignInSuccess::SUCCESS)); arc::mojom::ArcSignInSuccess::SUCCESS));
EXPECT_TRUE(result2.has_signin_result()); EXPECT_TRUE(result2.has_sign_in_result());
} }
TEST(ArcProvisioningResultTest, HasSignInError) { TEST(ArcProvisioningResultTest, HasSignInError) {
ArcProvisioningResult result1(ArcStopReason::CRASH); ArcProvisioningResult result1(ArcStopReason::CRASH);
EXPECT_FALSE(result1.has_signin_error()); EXPECT_FALSE(result1.has_sign_in_error());
ArcProvisioningResult result2(arc::mojom::ArcSignInResult::NewError( ArcProvisioningResult result2(arc::mojom::ArcSignInResult::NewError(
arc::mojom::ArcSignInError::NewGeneralError( arc::mojom::ArcSignInError::NewGeneralError(
arc::mojom::GeneralSignInError::CHROME_SERVER_COMMUNICATION_ERROR))); arc::mojom::GeneralSignInError::CHROME_SERVER_COMMUNICATION_ERROR)));
EXPECT_TRUE(result2.has_signin_error()); EXPECT_TRUE(result2.has_sign_in_error());
} }
TEST(ArcProvisioningResultTest, Success) { TEST(ArcProvisioningResultTest, Success) {
...@@ -63,7 +63,7 @@ TEST(ArcProvisioningResultTest, Timedout) { ...@@ -63,7 +63,7 @@ TEST(ArcProvisioningResultTest, Timedout) {
ArcProvisioningResult result1(ArcStopReason::CRASH); ArcProvisioningResult result1(ArcStopReason::CRASH);
EXPECT_FALSE(result1.is_timedout()); EXPECT_FALSE(result1.is_timedout());
ArcProvisioningResult result2(OverallSignInTimeout{}); ArcProvisioningResult result2(ChromeProvisioningTimeout{});
EXPECT_TRUE(result2.is_timedout()); EXPECT_TRUE(result2.is_timedout());
} }
......
...@@ -292,25 +292,25 @@ bool ReadSaltOnDisk(const base::FilePath& salt_path, std::string* out_salt) { ...@@ -292,25 +292,25 @@ bool ReadSaltOnDisk(const base::FilePath& salt_path, std::string* out_salt) {
return true; return true;
} }
int GetSignInErrorCode(const arc::mojom::ArcSignInError* signin_error) { int GetSignInErrorCode(const arc::mojom::ArcSignInError* sign_in_error) {
if (!signin_error) if (!sign_in_error)
return 0; return 0;
#define IF_ERROR_RETURN_CODE(name, type) \ #define IF_ERROR_RETURN_CODE(name, type) \
if (signin_error->is_##name()) { \ if (sign_in_error->is_##name()) { \
return static_cast<std::underlying_type_t<arc::mojom::type>>( \ return static_cast<std::underlying_type_t<arc::mojom::type>>( \
signin_error->get_##name()); \ sign_in_error->get_##name()); \
} }
IF_ERROR_RETURN_CODE(cloud_provision_flow_error, CloudProvisionFlowError) IF_ERROR_RETURN_CODE(cloud_provision_flow_error, CloudProvisionFlowError)
IF_ERROR_RETURN_CODE(general_error, GeneralSignInError) IF_ERROR_RETURN_CODE(general_error, GeneralSignInError)
IF_ERROR_RETURN_CODE(checkin_error, DeviceCheckInError) IF_ERROR_RETURN_CODE(check_in_error, GMSCheckInError)
IF_ERROR_RETURN_CODE(gms_error, GMSError) IF_ERROR_RETURN_CODE(sign_in_error, GMSSignInError)
#undef IF_ERROR_RETURN_CODE #undef IF_ERROR_RETURN_CODE
LOG(ERROR) << "Unknown sign-in error " LOG(ERROR) << "Unknown sign-in error "
<< std::underlying_type_t<arc::mojom::ArcSignInError::Tag>( << std::underlying_type_t<arc::mojom::ArcSignInError::Tag>(
signin_error->which()) sign_in_error->which())
<< "."; << ".";
return -1; return -1;
...@@ -578,8 +578,8 @@ void ArcSessionManager::OnProvisioningFinished( ...@@ -578,8 +578,8 @@ void ArcSessionManager::OnProvisioningFinished(
return; return;
} }
const mojom::ArcSignInError* signin_error = const mojom::ArcSignInError* sign_in_error =
result.has_signin_error() ? result.signin_error() : nullptr; result.has_sign_in_error() ? result.sign_in_error() : nullptr;
// Due asynchronous nature of stopping the ARC instance, // Due asynchronous nature of stopping the ARC instance,
// OnProvisioningFinished may arrive after setting the |State::STOPPED| state // OnProvisioningFinished may arrive after setting the |State::STOPPED| state
...@@ -625,9 +625,9 @@ void ArcSessionManager::OnProvisioningFinished( ...@@ -625,9 +625,9 @@ void ArcSessionManager::OnProvisioningFinished(
UpdateProvisioningTiming(base::TimeTicks::Now() - sign_in_start_time_, UpdateProvisioningTiming(base::TimeTicks::Now() - sign_in_start_time_,
provisioning_successful, profile_); provisioning_successful, profile_);
UpdateProvisioningResultUMA(GetProvisioningResultUMA(result), profile_); UpdateProvisioningResultUMA(GetProvisioningResultUMA(result), profile_);
if (signin_error && signin_error->is_cloud_provision_flow_error()) { if (sign_in_error && sign_in_error->is_cloud_provision_flow_error()) {
UpdateCloudProvisionFlowErrorUMA( UpdateCloudProvisionFlowErrorUMA(
signin_error->get_cloud_provision_flow_error(), profile_); sign_in_error->get_cloud_provision_flow_error(), profile_);
} }
if (!provisioning_successful) if (!provisioning_successful)
...@@ -670,20 +670,21 @@ void ArcSessionManager::OnProvisioningFinished( ...@@ -670,20 +670,21 @@ void ArcSessionManager::OnProvisioningFinished(
ArcSupportHost::Error support_error; ArcSupportHost::Error support_error;
VLOG(1) << "ARC provisioning failed: " << result << "."; VLOG(1) << "ARC provisioning failed: " << result << ".";
if (signin_error && signin_error->is_gms_error() && if (sign_in_error && sign_in_error->is_sign_in_error() &&
signin_error->get_gms_error() == mojom::GMSError::GMS_NETWORK_ERROR) { sign_in_error->get_sign_in_error() ==
mojom::GMSSignInError::GMS_SIGN_IN_NETWORK_ERROR) {
support_error = ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR; support_error = ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR;
} else if (signin_error && signin_error->is_gms_error() && } else if (sign_in_error && sign_in_error->is_sign_in_error() &&
signin_error->get_gms_error() == sign_in_error->get_sign_in_error() ==
mojom::GMSError::GMS_BAD_AUTHENTICATION) { mojom::GMSSignInError::GMS_SIGN_IN_BAD_AUTHENTICATION) {
support_error = ArcSupportHost::Error::SIGN_IN_BAD_AUTHENTICATION_ERROR; support_error = ArcSupportHost::Error::SIGN_IN_BAD_AUTHENTICATION_ERROR;
} else if (signin_error && signin_error->is_gms_error()) { } else if (sign_in_error && sign_in_error->is_sign_in_error()) {
support_error = ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR; support_error = ArcSupportHost::Error::SIGN_IN_SERVICE_UNAVAILABLE_ERROR;
} else if (signin_error && signin_error->is_checkin_error()) { } else if (sign_in_error && sign_in_error->is_check_in_error()) {
support_error = ArcSupportHost::Error::SIGN_IN_GMS_NOT_AVAILABLE_ERROR; support_error = ArcSupportHost::Error::SIGN_IN_GMS_NOT_AVAILABLE_ERROR;
} else if (signin_error && signin_error->is_cloud_provision_flow_error()) { } else if (sign_in_error && sign_in_error->is_cloud_provision_flow_error()) {
support_error = GetCloudProvisionFlowError( support_error = GetCloudProvisionFlowError(
signin_error->get_cloud_provision_flow_error()); sign_in_error->get_cloud_provision_flow_error());
} else if (result.has_general_error(mojom::GeneralSignInError:: } else if (result.has_general_error(mojom::GeneralSignInError::
CHROME_SERVER_COMMUNICATION_ERROR)) { CHROME_SERVER_COMMUNICATION_ERROR)) {
support_error = ArcSupportHost::Error::SERVER_COMMUNICATION_ERROR; support_error = ArcSupportHost::Error::SERVER_COMMUNICATION_ERROR;
...@@ -714,7 +715,7 @@ void ArcSessionManager::OnProvisioningFinished( ...@@ -714,7 +715,7 @@ void ArcSessionManager::OnProvisioningFinished(
ShutdownSession(); ShutdownSession();
} }
if ((signin_error && signin_error->is_cloud_provision_flow_error()) || if ((sign_in_error && sign_in_error->is_cloud_provision_flow_error()) ||
// OVERALL_SIGN_IN_TIMEOUT might be an indication that ARC believes it is // OVERALL_SIGN_IN_TIMEOUT might be an indication that ARC believes it is
// fully setup, but Chrome does not. // fully setup, but Chrome does not.
result.is_timedout() || result.is_timedout() ||
...@@ -728,8 +729,8 @@ void ArcSessionManager::OnProvisioningFinished( ...@@ -728,8 +729,8 @@ void ArcSessionManager::OnProvisioningFinished(
if (support_error == ArcSupportHost::Error::SIGN_IN_UNKNOWN_ERROR) { if (support_error == ArcSupportHost::Error::SIGN_IN_UNKNOWN_ERROR) {
error_code = static_cast<std::underlying_type_t<ProvisioningResultUMA>>( error_code = static_cast<std::underlying_type_t<ProvisioningResultUMA>>(
GetProvisioningResultUMA(result)); GetProvisioningResultUMA(result));
} else if (signin_error) { } else if (sign_in_error) {
error_code = GetSignInErrorCode(signin_error); error_code = GetSignInErrorCode(sign_in_error);
} }
ShowArcSupportHostError({support_error, error_code} /* error_info */, ShowArcSupportHostError({support_error, error_code} /* error_info */,
true /* should_show_send_feedback */); true /* should_show_send_feedback */);
...@@ -917,7 +918,7 @@ void ArcSessionManager::StopAndEnableArc() { ...@@ -917,7 +918,7 @@ void ArcSessionManager::StopAndEnableArc() {
void ArcSessionManager::OnArcSignInTimeout() { void ArcSessionManager::OnArcSignInTimeout() {
LOG(ERROR) << "Timed out waiting for first sign in."; LOG(ERROR) << "Timed out waiting for first sign in.";
OnProvisioningFinished(ArcProvisioningResult(OverallSignInTimeout())); OnProvisioningFinished(ArcProvisioningResult(ChromeProvisioningTimeout()));
} }
void ArcSessionManager::CancelAuthCode() { void ArcSessionManager::CancelAuthCode() {
......
...@@ -691,8 +691,8 @@ TEST_F(ArcSessionManagerTest, Provisioning_Restart) { ...@@ -691,8 +691,8 @@ TEST_F(ArcSessionManagerTest, Provisioning_Restart) {
// Report failure. // Report failure.
arc::mojom::ArcSignInResultPtr result = arc::mojom::ArcSignInResult::NewError( arc::mojom::ArcSignInResultPtr result = arc::mojom::ArcSignInResult::NewError(
arc::mojom::ArcSignInError::NewGmsError( arc::mojom::ArcSignInError::NewSignInError(
arc::mojom::GMSError::GMS_NETWORK_ERROR)); arc::mojom::GMSSignInError::GMS_SIGN_IN_NETWORK_ERROR));
arc_session_manager()->OnProvisioningFinished( arc_session_manager()->OnProvisioningFinished(
ArcProvisioningResult(std::move(result))); ArcProvisioningResult(std::move(result)));
...@@ -897,8 +897,8 @@ TEST_F(ArcSessionManagerTest, IgnoreSecondErrorReporting) { ...@@ -897,8 +897,8 @@ TEST_F(ArcSessionManagerTest, IgnoreSecondErrorReporting) {
// Report some failure that does not stop the bridge. // Report some failure that does not stop the bridge.
arc::mojom::ArcSignInResultPtr result = arc::mojom::ArcSignInResult::NewError( arc::mojom::ArcSignInResultPtr result = arc::mojom::ArcSignInResult::NewError(
arc::mojom::ArcSignInError::NewGmsError( arc::mojom::ArcSignInError::NewSignInError(
arc::mojom::GMSError::GMS_SIGN_IN_FAILED)); arc::mojom::GMSSignInError::GMS_SIGN_IN_FAILED));
arc_session_manager()->OnProvisioningFinished( arc_session_manager()->OnProvisioningFinished(
ArcProvisioningResult(std::move(result))); ArcProvisioningResult(std::move(result)));
EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state());
...@@ -1636,11 +1636,11 @@ struct ArcSessionRetryTestParam { ...@@ -1636,11 +1636,11 @@ struct ArcSessionRetryTestParam {
bool data_removed; bool data_removed;
absl::variant<arc::mojom::GeneralSignInError, absl::variant<arc::mojom::GeneralSignInError,
arc::mojom::GMSError, arc::mojom::GMSSignInError,
arc::mojom::DeviceCheckInError, arc::mojom::GMSCheckInError,
arc::mojom::CloudProvisionFlowError, arc::mojom::CloudProvisionFlowError,
ArcStopReason, ArcStopReason,
OverallSignInTimeout> ChromeProvisioningTimeout>
error; error;
}; };
...@@ -1648,29 +1648,29 @@ ArcSessionRetryTestParam kRetryTestCases[] = { ...@@ -1648,29 +1648,29 @@ ArcSessionRetryTestParam kRetryTestCases[] = {
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, true, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, true,
arc::mojom::GeneralSignInError::UNKNOWN_ERROR}, arc::mojom::GeneralSignInError::UNKNOWN_ERROR},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GMSError::GMS_NETWORK_ERROR}, arc::mojom::GMSSignInError::GMS_SIGN_IN_NETWORK_ERROR},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GMSError::GMS_SERVICE_UNAVAILABLE}, arc::mojom::GMSSignInError::GMS_SIGN_IN_SERVICE_UNAVAILABLE},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GMSError::GMS_BAD_AUTHENTICATION}, arc::mojom::GMSSignInError::GMS_SIGN_IN_BAD_AUTHENTICATION},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::DeviceCheckInError::DEVICE_CHECK_IN_FAILED}, arc::mojom::GMSCheckInError::GMS_CHECK_IN_FAILED},
{ArcSessionRetryTestParam::Negotiation::SKIPPED, true, true, {ArcSessionRetryTestParam::Negotiation::SKIPPED, true, true,
arc::mojom::CloudProvisionFlowError::ERROR_OTHER}, arc::mojom::CloudProvisionFlowError::ERROR_OTHER},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GeneralSignInError::MOJO_VERSION_MISMATCH}, arc::mojom::GeneralSignInError::MOJO_VERSION_MISMATCH},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GeneralSignInError::PROVISIONING_TIMEOUT}, arc::mojom::GeneralSignInError::GENERIC_PROVISIONING_TIMEOUT},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::DeviceCheckInError::DEVICE_CHECK_IN_TIMEOUT}, arc::mojom::GMSCheckInError::GMS_CHECK_IN_TIMEOUT},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::DeviceCheckInError::DEVICE_CHECK_IN_INTERNAL_ERROR}, arc::mojom::GMSCheckInError::GMS_CHECK_IN_INTERNAL_ERROR},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GMSError::GMS_SIGN_IN_FAILED}, arc::mojom::GMSSignInError::GMS_SIGN_IN_FAILED},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GMSError::GMS_SIGN_IN_TIMEOUT}, arc::mojom::GMSSignInError::GMS_SIGN_IN_TIMEOUT},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
arc::mojom::GMSError::GMS_SIGN_IN_INTERNAL_ERROR}, arc::mojom::GMSSignInError::GMS_SIGN_IN_INTERNAL_ERROR},
{ArcSessionRetryTestParam::Negotiation::SKIPPED, true, true, {ArcSessionRetryTestParam::Negotiation::SKIPPED, true, true,
arc::mojom::CloudProvisionFlowError::ERROR_TIMEOUT}, arc::mojom::CloudProvisionFlowError::ERROR_TIMEOUT},
{ArcSessionRetryTestParam::Negotiation::SKIPPED, true, true, {ArcSessionRetryTestParam::Negotiation::SKIPPED, true, true,
...@@ -1678,7 +1678,7 @@ ArcSessionRetryTestParam kRetryTestCases[] = { ...@@ -1678,7 +1678,7 @@ ArcSessionRetryTestParam kRetryTestCases[] = {
{ArcSessionRetryTestParam::Negotiation::REQUIRED, false, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, false, false,
ArcStopReason::CRASH}, ArcStopReason::CRASH},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, true, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, true,
OverallSignInTimeout{}}, ChromeProvisioningTimeout{}},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, false, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, false, false,
arc::mojom::GeneralSignInError::CHROME_SERVER_COMMUNICATION_ERROR}, arc::mojom::GeneralSignInError::CHROME_SERVER_COMMUNICATION_ERROR},
{ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false, {ArcSessionRetryTestParam::Negotiation::REQUIRED, true, false,
...@@ -1752,10 +1752,10 @@ TEST_P(ArcSessionRetryTest, ContainerRestarted) { ...@@ -1752,10 +1752,10 @@ TEST_P(ArcSessionRetryTest, ContainerRestarted) {
arc_session_manager()->StartArcForTesting(); arc_session_manager()->StartArcForTesting();
EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state()); EXPECT_EQ(ArcSessionManager::State::ACTIVE, arc_session_manager()->state());
absl::variant<arc::mojom::GeneralSignInError, arc::mojom::GMSError, absl::variant<arc::mojom::GeneralSignInError, arc::mojom::GMSSignInError,
arc::mojom::DeviceCheckInError, arc::mojom::GMSCheckInError,
arc::mojom::CloudProvisionFlowError, ArcStopReason, arc::mojom::CloudProvisionFlowError, ArcStopReason,
OverallSignInTimeout> ChromeProvisioningTimeout>
error = std::move(GetParam().error); error = std::move(GetParam().error);
if (absl::holds_alternative<arc::mojom::CloudProvisionFlowError>(error)) { if (absl::holds_alternative<arc::mojom::CloudProvisionFlowError>(error)) {
...@@ -1771,19 +1771,19 @@ TEST_P(ArcSessionRetryTest, ContainerRestarted) { ...@@ -1771,19 +1771,19 @@ TEST_P(ArcSessionRetryTest, ContainerRestarted) {
arc::mojom::ArcSignInError::NewGeneralError( arc::mojom::ArcSignInError::NewGeneralError(
absl::get<arc::mojom::GeneralSignInError>(error)))); absl::get<arc::mojom::GeneralSignInError>(error))));
arc_session_manager()->OnProvisioningFinished(result); arc_session_manager()->OnProvisioningFinished(result);
} else if (absl::holds_alternative<arc::mojom::GMSError>(error)) { } else if (absl::holds_alternative<arc::mojom::GMSSignInError>(error)) {
ArcProvisioningResult result(arc::mojom::ArcSignInResult::NewError( ArcProvisioningResult result(arc::mojom::ArcSignInResult::NewError(
arc::mojom::ArcSignInError::NewGmsError( arc::mojom::ArcSignInError::NewSignInError(
absl::get<arc::mojom::GMSError>(error)))); absl::get<arc::mojom::GMSSignInError>(error))));
arc_session_manager()->OnProvisioningFinished(result); arc_session_manager()->OnProvisioningFinished(result);
} else if (absl::holds_alternative<arc::mojom::DeviceCheckInError>(error)) { } else if (absl::holds_alternative<arc::mojom::GMSCheckInError>(error)) {
ArcProvisioningResult result(arc::mojom::ArcSignInResult::NewError( ArcProvisioningResult result(arc::mojom::ArcSignInResult::NewError(
arc::mojom::ArcSignInError::NewCheckinError( arc::mojom::ArcSignInError::NewCheckInError(
absl::get<arc::mojom::DeviceCheckInError>(error)))); absl::get<arc::mojom::GMSCheckInError>(error))));
arc_session_manager()->OnProvisioningFinished(result); arc_session_manager()->OnProvisioningFinished(result);
} else if (absl::holds_alternative<OverallSignInTimeout>(error)) { } else if (absl::holds_alternative<ChromeProvisioningTimeout>(error)) {
arc_session_manager()->OnProvisioningFinished( arc_session_manager()->OnProvisioningFinished(
ArcProvisioningResult(OverallSignInTimeout{})); ArcProvisioningResult(ChromeProvisioningTimeout{}));
} }
// In case of permanent error data removal request is scheduled. // In case of permanent error data removal request is scheduled.
......
...@@ -36,9 +36,9 @@ enum GeneralSignInError { ...@@ -36,9 +36,9 @@ enum GeneralSignInError {
// due to Host/Instance version mismatch. // due to Host/Instance version mismatch.
MOJO_VERSION_MISMATCH = 1, MOJO_VERSION_MISMATCH = 1,
// PROVISIONING_TIMEOUT: is sent when provisioning is started // GENERIC_PROVISIONING_TIMEOUT: is sent when provisioning is started
// but not completed with time out. // but not completed with time out.
PROVISIONING_TIMEOUT = 2, GENERIC_PROVISIONING_TIMEOUT = 2,
// Network connection is unavailable. // Network connection is unavailable.
NO_NETWORK_CONNECTION = 3, NO_NETWORK_CONNECTION = 3,
...@@ -57,39 +57,39 @@ enum GeneralSignInError { ...@@ -57,39 +57,39 @@ enum GeneralSignInError {
}; };
[Extensible] [Extensible]
enum DeviceCheckInError { enum GMSCheckInError {
// Next value: 4. // Next value: 4.
// DEVICE_CHECK_IN_FAILED: is sent when "check-in" procedure is completed // GMS_CHECK_IN_FAILED: is sent when "check-in" procedure is completed
// but is actually failed. // but is actually failed.
DEVICE_CHECK_IN_FAILED = 1, GMS_CHECK_IN_FAILED = 1,
// DEVICE_CHECK_IN_TIMEOUT: is sent when "check-in" procedure started // GMS_CHECK_IN_TIMEOUT: is sent when "check-in" procedure started
// but is not completed. // but is not completed.
DEVICE_CHECK_IN_TIMEOUT = 2, GMS_CHECK_IN_TIMEOUT = 2,
// DEVICE_CHECK_IN_INTERNAL_ERROR: is sent when "check-in" procedure is // GMS_CHECK_IN_INTERNAL_ERROR: is sent when "check-in" procedure is
// started, but some unexpected error situation happens so that it could // started, but some unexpected error situation happens so that it could
// not completed. // not completed.
DEVICE_CHECK_IN_INTERNAL_ERROR = 3, GMS_CHECK_IN_INTERNAL_ERROR = 3,
}; };
[Extensible] [Extensible]
enum GMSError { enum GMSSignInError {
// Next value: 7. // Next value: 7.
// GMS_NETWORK_ERROR: is sent when GMS sign-in procedure is started, but // GMS_SIGN_IN_NETWORK_ERROR: is sent when GMS sign-in procedure is
// it reports NETWORK_ERROR. // started, but it reports NETWORK_ERROR.
GMS_NETWORK_ERROR = 1, GMS_SIGN_IN_NETWORK_ERROR = 1,
// GMS_SERVICE_UNAVAILABLE: is sent when GMS sign-in procedure is started // GMS_SIGN_IN_SERVICE_UNAVAILABLE: is sent when GMS sign-in
// but it reports SERVICE_UNAVAILABLE. Note that this is not generic // procedure is started but it reports SERVICE_UNAVAILABLE. Note
// service unavailable error code. // that this is not generic service unavailable error code.
GMS_SERVICE_UNAVAILABLE = 2, GMS_SIGN_IN_SERVICE_UNAVAILABLE = 2,
// GMS_BAD_AUTHENTICATION: is sent when GMS sign-in procedure is started // GMS_SIGN_IN_BAD_AUTHENTICATION: is sent when GMS sign-in procedure
// but it reports BAD_AUTHENTICATION. // is started but it reports BAD_AUTHENTICATION.
GMS_BAD_AUTHENTICATION = 3, GMS_SIGN_IN_BAD_AUTHENTICATION = 3,
// GMS_SIGN_IN_FAILED: is sent when GMS sign in procedure is started but // GMS_SIGN_IN_FAILED: is sent when GMS sign in procedure is started but
// it reports an error other than above NETWORK_ERROR, SERVICE_UNAVAILABLE // it reports an error other than above NETWORK_ERROR, SERVICE_UNAVAILABLE
...@@ -178,8 +178,8 @@ enum ArcSignInSuccess { ...@@ -178,8 +178,8 @@ enum ArcSignInSuccess {
union ArcSignInError { union ArcSignInError {
CloudProvisionFlowError cloud_provision_flow_error; CloudProvisionFlowError cloud_provision_flow_error;
[MinVersion=26] GeneralSignInError general_error; [MinVersion=26] GeneralSignInError general_error;
[MinVersion=26] GMSError gms_error; [MinVersion=26] GMSSignInError sign_in_error;
[MinVersion=26] DeviceCheckInError checkin_error; [MinVersion=26] GMSCheckInError check_in_error;
}; };
union ArcSignInResult { union ArcSignInResult {
......
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