#include "remoting/test/test_token_storage.h"
#include <optional>
#include "base/files/file_util.h"
#include "base/files/important_file_writer.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/values.h"
namespace {
const base::FilePath::CharType kTokenFileName[] = …);
const base::FilePath::CharType kRemotingFolder[] = …);
const base::FilePath::CharType kTokenStoreFolder[] = …);
constexpr char kUnspecifiedUsername[] = …;
constexpr char kRefreshTokenKey[] = …;
constexpr char kUserEmailKey[] = …;
constexpr char kAccessTokenKey[] = …;
constexpr char kDeviceIdKey[] = …;
}
namespace remoting {
namespace test {
class TestTokenStorageOnDisk : public TestTokenStorage { … };
TestTokenStorageOnDisk::TestTokenStorageOnDisk(const std::string& user_name,
const base::FilePath& file_path)
: … { … }
TestTokenStorageOnDisk::~TestTokenStorageOnDisk() = default;
std::string TestTokenStorageOnDisk::FetchRefreshToken() { … }
bool TestTokenStorageOnDisk::StoreRefreshToken(
const std::string& refresh_token) { … }
std::string TestTokenStorageOnDisk::FetchUserEmail() { … }
bool TestTokenStorageOnDisk::StoreUserEmail(const std::string& user_email) { … }
std::string TestTokenStorageOnDisk::FetchAccessToken() { … }
bool TestTokenStorageOnDisk::StoreAccessToken(const std::string& access_token) { … }
std::string TestTokenStorageOnDisk::FetchDeviceId() { … }
bool TestTokenStorageOnDisk::StoreDeviceId(const std::string& device_id) { … }
std::string TestTokenStorageOnDisk::FetchTokenFromKey(const std::string& key) { … }
bool TestTokenStorageOnDisk::StoreTokenForKey(const std::string& key,
const std::string& value) { … }
base::FilePath TestTokenStorageOnDisk::GetPathForTokens() { … }
std::unique_ptr<TestTokenStorage> TestTokenStorage::OnDisk(
const std::string& user_name,
const base::FilePath& refresh_token_file_path) { … }
}
}