#include "components/os_crypt/sync/key_storage_kwallet.h"
#include "base/memory/raw_ptr.h"
#include "base/nix/xdg_util.h"
#include "build/branding_buildflags.h"
#include "components/os_crypt/sync/kwallet_dbus.h"
#include "dbus/message.h"
#include "dbus/mock_bus.h"
#include "dbus/mock_object_proxy.h"
#include "dbus/object_path.h"
#include "dbus/object_proxy.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
_;
DoAll;
Return;
SaveArg;
SetArgPointee;
StrictMock;
constexpr KWalletDBus::Error SUCCESS = …;
constexpr KWalletDBus::Error CANNOT_READ = …;
constexpr KWalletDBus::Error CANNOT_CONTACT = …;
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
const char kExpectedFolderName[] = "Chrome Keys";
const char kExpectedEntryName[] = "Chrome Safe Storage";
#else
const char kExpectedFolderName[] = …;
const char kExpectedEntryName[] = …;
#endif
const char kAppName[] = …;
constexpr int kSuccessReturnCode = …;
const base::nix::DesktopEnvironment kDesktopEnv = …;
class MockKWalletDBus : public KWalletDBus { … };
class KeyStorageKWalletTest : public testing::Test { … };
TEST_F(KeyStorageKWalletTest, InitializeFolder) { … }
TEST_F(KeyStorageKWalletTest, EmptyFolder) { … }
TEST_F(KeyStorageKWalletTest, WrongEntryType) { … }
TEST_F(KeyStorageKWalletTest, ExistingPassword) { … }
TEST_F(KeyStorageKWalletTest, GenerateNewPassword) { … }
TEST_F(KeyStorageKWalletTest, GenerateNewPasswordWhenEmpty) { … }
TEST_F(KeyStorageKWalletTest, InitKWalletNotEnabled) { … }
TEST_F(KeyStorageKWalletTest, InitCannotStart) { … }
TEST_F(KeyStorageKWalletTest, InitFailTwice) { … }
TEST_F(KeyStorageKWalletTest, InitTryTwiceAndFail) { … }
TEST_F(KeyStorageKWalletTest, InitTryTwiceAndSuccess) { … }
class KeyStorageKWalletFailuresTest
: public testing::TestWithParam<KWalletDBus::Error> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureOpen) { … }
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureHasFolder) { … }
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureCreateFolder) { … }
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureHasEntry) { … }
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureEntryType) { … }
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureReadPassword) { … }
TEST_P(KeyStorageKWalletFailuresTest, PostInitFailureWritePassword) { … }
}