internal changes.

PiperOrigin-RevId: 658928907
This commit is contained in:
Francis Tsui
2024-08-02 15:47:15 -07:00
committed by Copybara-Service
parent c1c4d52e79
commit a8757a2c49
2 changed files with 55 additions and 1 deletions
+6 -1
View File
@@ -17,10 +17,15 @@ licenses(["notice"])
cc_library(
name = "mocks",
testonly = 1,
hdrs = ["mock_account_observer.h"],
hdrs = [
"mock_account_manager.h",
"mock_account_observer.h",
],
visibility = ["//visibility:public"],
deps = [
"//internal/platform/implementation:account_manager",
"@com_google_absl//absl/functional:any_invocable",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings:string_view",
"@com_google_googletest//:gtest_for_library_testonly",
],
+49
View File
@@ -0,0 +1,49 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_
#define THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_
#include <optional>
#include "gmock/gmock.h"
#include "absl/functional/any_invocable.h"
#include "absl/status/status.h"
#include "absl/strings/string_view.h"
#include "internal/platform/implementation/account_manager.h"
namespace nearby {
class MockAccountManager : public AccountManager {
public:
MOCK_METHOD(std::optional<Account>, GetCurrentAccount, (), (override));
MOCK_METHOD(void, Login,
(absl::AnyInvocable<void(Account)> login_success_callback,
absl::AnyInvocable<void(absl::Status)> login_failure_callback),
(override));
MOCK_METHOD(void, Logout,
(absl::AnyInvocable<void(absl::Status)> logout_callback),
(override));
MOCK_METHOD(bool, GetAccessToken,
(absl::string_view account_id,
absl::AnyInvocable<void(absl::string_view)> success_callback,
absl::AnyInvocable<void(absl::Status)> failure_callback),
(override));
MOCK_METHOD(void, AddObserver, (Observer * observer), (override));
MOCK_METHOD(void, RemoveObserver, (Observer * observer), (override));
};
} // namespace nearby
#endif // THIRD_PARTY_NEARBY_INTERNAL_TEST_MOCK_ACCOUNT_MANAGER_H_