Roll src/chromeos/assistant/internal/ 65a8600f5..0830f532b (1 commit)
65a8600f50..0830f532b3
$ git log 65a8600f5..0830f532b --date=short --no-merges --format='%ad %ae %s'
Created with:
roll-dep src/chromeos/assistant/internal
Bug: b/323365360
Test: can build
Change-Id: I14031eadde03416cdc54b1d57dd0c329542f7115
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5261760
Commit-Queue: Tao Wu <wutao@chromium.org>
Reviewed-by: Yuki Awano <yawano@google.com>
Cr-Commit-Position: refs/heads/main@{#1255779}
This commit is contained in:
2
DEPS
2
DEPS
@ -3774,7 +3774,7 @@ deps = {
|
||||
# Dependencies from src_internal
|
||||
'src/chromeos/assistant/internal': {
|
||||
'url': Var('chrome_git') + '/chrome/assistant.git' + '@' +
|
||||
'65a8600f50524baa9a4f0c3c06bac1bfa8a39245',
|
||||
'0830f532b388d65dcf4f1c04eef5b6d30d4692e4',
|
||||
'condition': 'checkout_src_internal and checkout_chromeos',
|
||||
},
|
||||
|
||||
|
@ -15,31 +15,6 @@ namespace ash::libassistant {
|
||||
|
||||
namespace {
|
||||
|
||||
// Return the list of all libassistant error codes that are considered to be
|
||||
// authentication errors. This list is created on demand as there is no clear
|
||||
// enum that defines these, and we don't want to hard code this list in the
|
||||
// test.
|
||||
std::vector<int> GetAuthenticationErrorCodes() {
|
||||
const int kMinErrorCode = chromeos::assistant::GetLowestErrorCode();
|
||||
const int kMaxErrorCode = chromeos::assistant::GetHighestErrorCode();
|
||||
|
||||
std::vector<int> result;
|
||||
for (int code = kMinErrorCode; code <= kMaxErrorCode; ++code) {
|
||||
if (chromeos::assistant::IsAuthError(code)) {
|
||||
result.push_back(code);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// Return a list of some libassistant error codes that are not considered to be
|
||||
// authentication errors. Note we do not return all such codes as there are
|
||||
// simply too many and testing them all significantly slows down the tests.
|
||||
std::vector<int> GetNonAuthenticationErrorCodes() {
|
||||
return {-99999, 0, 1};
|
||||
}
|
||||
|
||||
class AuthenticationStateObserverMock
|
||||
: public mojom::AuthenticationStateObserver {
|
||||
public:
|
||||
@ -90,11 +65,7 @@ class AuthenticationStateObserverTest : public ::testing::Test {
|
||||
|
||||
void FlushMojomPipes() { service_tester_.FlushForTesting(); }
|
||||
|
||||
void OnCommunicationError(int error_code) {
|
||||
if (!chromeos::assistant::IsAuthError(error_code)) {
|
||||
return;
|
||||
}
|
||||
|
||||
void OnCommunicationError() {
|
||||
::assistant::api::OnDeviceStateEventRequest request;
|
||||
auto* communication_error =
|
||||
request.mutable_event()->mutable_on_communication_error();
|
||||
@ -113,29 +84,12 @@ class AuthenticationStateObserverTest : public ::testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(AuthenticationStateObserverTest, ShouldReportAuthenticationErrors) {
|
||||
for (int code : GetAuthenticationErrorCodes()) {
|
||||
EXPECT_CALL(observer_mock(), OnAuthenticationError());
|
||||
OnCommunicationError(code);
|
||||
EXPECT_CALL(observer_mock(), OnAuthenticationError());
|
||||
OnCommunicationError();
|
||||
|
||||
FlushMojomPipes();
|
||||
ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(&observer_mock()))
|
||||
<< "Failure for error code " << code;
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(AuthenticationStateObserverTest, ShouldIgnoreNonAuthenticationErrors) {
|
||||
std::vector<int> non_authentication_errors = GetNonAuthenticationErrorCodes();
|
||||
|
||||
for (int code : non_authentication_errors) {
|
||||
// check to ensure these are not authentication errors.
|
||||
ASSERT_FALSE(chromeos::assistant::IsAuthError(code));
|
||||
EXPECT_CALL(observer_mock(), OnAuthenticationError()).Times(0);
|
||||
OnCommunicationError(code);
|
||||
|
||||
FlushMojomPipes();
|
||||
ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(&observer_mock()))
|
||||
<< "Failure for error code " << code;
|
||||
}
|
||||
FlushMojomPipes();
|
||||
ASSERT_TRUE(testing::Mock::VerifyAndClearExpectations(&observer_mock()))
|
||||
<< "Failure to receive Auth error.";
|
||||
}
|
||||
|
||||
} // namespace ash::libassistant
|
||||
|
Submodule chromeos/assistant/internal updated: 65a8600f50...0830f532b3
Reference in New Issue
Block a user