| Index: chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
|
| diff --git a/chrome/browser/extensions/api/networking_private/networking_private_crypto_unittest.cc b/chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
|
| similarity index 93%
|
| rename from chrome/browser/extensions/api/networking_private/networking_private_crypto_unittest.cc
|
| rename to chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
|
| index 486166fce3e8a5c130e6c96b0e3a975c51732b69..b46749da556e586e41f0b1bae86690afa9d9e298 100644
|
| --- a/chrome/browser/extensions/api/networking_private/networking_private_crypto_unittest.cc
|
| +++ b/chrome/common/extensions/api/networking_private/networking_private_crypto_unittest.cc
|
| @@ -1,7 +1,7 @@
|
| // Copyright 2013 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
| -#include "chrome/browser/extensions/api/networking_private/networking_private_crypto.h"
|
| +#include "chrome/common/extensions/api/networking_private/networking_private_crypto.h"
|
|
|
| #include "base/base64.h"
|
| #include "base/logging.h"
|
| @@ -15,7 +15,7 @@ class NetworkingPrivateCryptoTest : public testing::Test {
|
| // |plain| data.
|
| bool VerifyByteString(const std::string& private_key_pem,
|
| const std::string& plain,
|
| - const std::string& encrypted) {
|
| + const std::vector<uint8>& encrypted) {
|
| NetworkingPrivateCrypto crypto;
|
| std::string decrypted;
|
| if (crypto.DecryptByteString(private_key_pem, encrypted, &decrypted))
|
| @@ -138,16 +138,16 @@ TEST_F(NetworkingPrivateCryptoTest, EncryptByteString) {
|
| "e5ZqY4RmsQmv6K0rn5k+UT4qlPeVp1e6LnvO/PcKWOaUvDK59qFZoX4vN+iFUAbk"
|
| "IuvhmL9u/uPWWck="
|
| "-----END PRIVATE KEY-----";
|
| - static const char kBadKeyData[] = "bad key";
|
| + static const std::vector<uint8> kBadKeyData(5, 111);
|
| static const char kTestData[] = "disco boy";
|
| static const char kEmptyData[] = "";
|
|
|
| -
|
| - std::string public_key;
|
| - base::Base64Decode(kPublicKey, &public_key);
|
| -
|
| + std::string public_key_string;
|
| + base::Base64Decode(kPublicKey, &public_key_string);
|
| + std::vector<uint8> public_key(public_key_string.begin(),
|
| + public_key_string.end());
|
| std::string plain;
|
| - std::string encrypted_output;
|
| + std::vector<uint8> encrypted_output;
|
|
|
| // Checking basic encryption operation.
|
| plain = kTestData;
|
| @@ -159,13 +159,10 @@ TEST_F(NetworkingPrivateCryptoTest, EncryptByteString) {
|
| EXPECT_TRUE(crypto.EncryptByteString(public_key, plain, &encrypted_output));
|
|
|
| // Checking graceful fail for too much data to encrypt.
|
| - EXPECT_FALSE(
|
| - crypto.EncryptByteString(public_key,
|
| - std::string(500, 'x'),
|
| - &encrypted_output));
|
| + EXPECT_FALSE(crypto.EncryptByteString(
|
| + public_key, std::string(500, 'x'), &encrypted_output));
|
|
|
| // Checking graceful fail for a bad key format.
|
| EXPECT_FALSE(
|
| crypto.EncryptByteString(kBadKeyData, kTestData, &encrypted_output));
|
| }
|
| -
|
|
|