OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
ypto.h" | 4 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
ypto.h" |
5 | 5 |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/stringprintf.h" | |
11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
12 | 11 |
13 namespace { | 12 namespace { |
14 | 13 |
15 } // namespace | 14 } // namespace |
16 | 15 |
17 // Tests of networking_private_crypto support for Networking Private API. | 16 // Tests of networking_private_crypto support for Networking Private API. |
18 class NetworkingPrivateCryptoTest : public testing::Test { | 17 class NetworkingPrivateCryptoTest : public testing::Test { |
19 protected: | 18 protected: |
20 // Verify that decryption of |encrypted| data using |private_key_pem| matches | 19 // Verify that decryption of |encrypted| data using |private_key_pem| matches |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 public_key, plain, &encrypted_output)); | 221 public_key, plain, &encrypted_output)); |
223 | 222 |
224 // Checking graceful fail for too much data to encrypt. | 223 // Checking graceful fail for too much data to encrypt. |
225 EXPECT_FALSE(networking_private_crypto::EncryptByteString( | 224 EXPECT_FALSE(networking_private_crypto::EncryptByteString( |
226 public_key, std::string(500, 'x'), &encrypted_output)); | 225 public_key, std::string(500, 'x'), &encrypted_output)); |
227 | 226 |
228 // Checking graceful fail for a bad key format. | 227 // Checking graceful fail for a bad key format. |
229 EXPECT_FALSE(networking_private_crypto::EncryptByteString( | 228 EXPECT_FALSE(networking_private_crypto::EncryptByteString( |
230 kBadKeyData, kTestData, &encrypted_output)); | 229 kBadKeyData, kTestData, &encrypted_output)); |
231 } | 230 } |
OLD | NEW |