This source file includes following definitions.
- TEST_F
#include "components/sync_driver/system_encryptor.h"
#include "components/os_crypt/os_crypt.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace browser_sync {
namespace {
const char kPlaintext[] = "The Magic Words are Squeamish Ossifrage";
class SystemEncryptorTest : public testing::Test {
protected:
SystemEncryptor encryptor_;
};
TEST_F(SystemEncryptorTest, EncryptDecrypt) {
#if defined(OS_MACOSX)
::OSCrypt::UseMockKeychain(true);
#endif
std::string ciphertext;
EXPECT_TRUE(encryptor_.EncryptString(kPlaintext, &ciphertext));
EXPECT_NE(kPlaintext, ciphertext);
std::string plaintext;
EXPECT_TRUE(encryptor_.DecryptString(ciphertext, &plaintext));
EXPECT_EQ(kPlaintext, plaintext);
}
}
}