#include "chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h"
#include <optional>
#include <string>
#include "base/containers/contains.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_event_router.h"
#include "chrome/browser/extensions/api/passwords_private/passwords_private_event_router_factory.h"
#include "ui/base/l10n/time_format.h"
#include "url/gurl.h"
namespace extensions {
namespace {
TimeFormat;
constexpr size_t kNumMocks = …;
api::passwords_private::PasswordUiEntry CreateEntry(int id) { … }
api::passwords_private::ExceptionEntry CreateException(int id) { … }
}
TestPasswordsPrivateDelegate::TestPasswordsPrivateDelegate()
: … { … }
TestPasswordsPrivateDelegate::~TestPasswordsPrivateDelegate() = default;
void TestPasswordsPrivateDelegate::GetSavedPasswordsList(
UiEntriesCallback callback) { … }
PasswordsPrivateDelegate::CredentialsGroups
TestPasswordsPrivateDelegate::GetCredentialGroups() { … }
void TestPasswordsPrivateDelegate::GetPasswordExceptionsList(
ExceptionEntriesCallback callback) { … }
std::optional<api::passwords_private::UrlCollection>
TestPasswordsPrivateDelegate::GetUrlCollection(const std::string& url) { … }
bool TestPasswordsPrivateDelegate::IsAccountStoreDefault(
content::WebContents* web_contents) { … }
bool TestPasswordsPrivateDelegate::AddPassword(
const std::string& url,
const std::u16string& username,
const std::u16string& password,
const std::u16string& note,
bool use_account_store,
content::WebContents* web_contents) { … }
bool TestPasswordsPrivateDelegate::ChangeCredential(
const api::passwords_private::PasswordUiEntry& credential) { … }
void TestPasswordsPrivateDelegate::RemoveCredential(
int id,
api::passwords_private::PasswordStoreSet from_stores) { … }
void TestPasswordsPrivateDelegate::RemovePasswordException(int id) { … }
void TestPasswordsPrivateDelegate::UndoRemoveSavedPasswordOrException() { … }
void TestPasswordsPrivateDelegate::RequestPlaintextPassword(
int id,
api::passwords_private::PlaintextReason reason,
PlaintextPasswordCallback callback,
content::WebContents* web_contents) { … }
void TestPasswordsPrivateDelegate::RequestCredentialsDetails(
const std::vector<int>& ids,
UiEntriesCallback callback,
content::WebContents* web_contents) { … }
void TestPasswordsPrivateDelegate::MovePasswordsToAccount(
const std::vector<int>& ids,
content::WebContents* web_contents) { … }
void TestPasswordsPrivateDelegate::ImportPasswords(
api::passwords_private::PasswordStoreSet to_store,
ImportResultsCallback results_callback,
content::WebContents* web_contents) { … }
void TestPasswordsPrivateDelegate::ContinueImport(
const std::vector<int>& selected_ids,
ImportResultsCallback results_callback,
content::WebContents* web_contents) { … }
void TestPasswordsPrivateDelegate::FetchFamilyMembers(
FetchFamilyResultsCallback callback) { … }
void TestPasswordsPrivateDelegate::SharePassword(
int id,
const ShareRecipients& recipients) { … }
void TestPasswordsPrivateDelegate::ResetImporter(bool delete_file) { … }
void TestPasswordsPrivateDelegate::ExportPasswords(
base::OnceCallback<void(const std::string&)> callback,
content::WebContents* web_contents) { … }
api::passwords_private::ExportProgressStatus
TestPasswordsPrivateDelegate::GetExportProgressStatus() { … }
bool TestPasswordsPrivateDelegate::IsOptedInForAccountStorage() { … }
void TestPasswordsPrivateDelegate::SetAccountStorageOptIn(
bool opt_in,
content::WebContents* web_contents) { … }
std::vector<api::passwords_private::PasswordUiEntry>
TestPasswordsPrivateDelegate::GetInsecureCredentials() { … }
std::vector<api::passwords_private::PasswordUiEntryList>
TestPasswordsPrivateDelegate::GetCredentialsWithReusedPassword() { … }
bool TestPasswordsPrivateDelegate::MuteInsecureCredential(
const api::passwords_private::PasswordUiEntry& credential) { … }
bool TestPasswordsPrivateDelegate::UnmuteInsecureCredential(
const api::passwords_private::PasswordUiEntry& credential) { … }
void TestPasswordsPrivateDelegate::StartPasswordCheck(
StartPasswordCheckCallback callback) { … }
api::passwords_private::PasswordCheckStatus
TestPasswordsPrivateDelegate::GetPasswordCheckStatus() { … }
password_manager::InsecureCredentialsManager*
TestPasswordsPrivateDelegate::GetInsecureCredentialsManager() { … }
void TestPasswordsPrivateDelegate::RestartAuthTimer() { … }
void TestPasswordsPrivateDelegate::SetProfile(Profile* profile) { … }
void TestPasswordsPrivateDelegate::SetOptedInForAccountStorage(bool opted_in) { … }
void TestPasswordsPrivateDelegate::SetIsAccountStoreDefault(bool is_default) { … }
void TestPasswordsPrivateDelegate::AddCompromisedCredential(int id) { … }
void TestPasswordsPrivateDelegate::SendSavedPasswordsList() { … }
void TestPasswordsPrivateDelegate::SendPasswordExceptionsList() { … }
bool TestPasswordsPrivateDelegate::IsCredentialPresentInInsecureCredentialsList(
const api::passwords_private::PasswordUiEntry& credential) { … }
void TestPasswordsPrivateDelegate::SwitchBiometricAuthBeforeFillingState(
content::WebContents* web_contents,
AuthenticationCallback callback) { … }
void TestPasswordsPrivateDelegate::ShowAddShortcutDialog(
content::WebContents* web_contents) { … }
void TestPasswordsPrivateDelegate::ShowExportedFileInShell(
content::WebContents* web_contents,
std::string file_path) { … }
void TestPasswordsPrivateDelegate::ChangePasswordManagerPin(
content::WebContents* web_contents,
base::OnceCallback<void(bool)> success_callback) { … }
void TestPasswordsPrivateDelegate::DeleteAllPasswordManagerData(
content::WebContents* web_contents,
base::OnceCallback<void(bool)> success_callback) { … }
void TestPasswordsPrivateDelegate::IsPasswordManagerPinAvailable(
content::WebContents* web_contents,
base::OnceCallback<void(bool)> pin_available_callback) { … }
void TestPasswordsPrivateDelegate::DisconnectCloudAuthenticator(
content::WebContents* web_contents,
base::OnceCallback<void(bool)> success_callback) { … }
bool TestPasswordsPrivateDelegate::IsConnectedToCloudAuthenticator(
content::WebContents* web_contents) { … }
base::WeakPtr<PasswordsPrivateDelegate>
TestPasswordsPrivateDelegate::AsWeakPtr() { … }
}