Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc

Issue 2740453006: Add QuicStringPiece which is actually StringPiece. (Closed)
Patch Set: fix compile error and rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc ('k') | net/quic/core/crypto/channel_id.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
diff --git a/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc b/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
index 97528430ee33858689991bf6c8659a8b4603a649..f7c847a3bba4e3b97b9328b9cfb6286895c38883 100644
--- a/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
+++ b/net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc
@@ -11,7 +11,6 @@
#include "net/quic/platform/api/quic_text_utils.h"
#include "net/quic/test_tools/quic_test_utils.h"
-using base::StringPiece;
using std::string;
namespace {
@@ -70,9 +69,9 @@ namespace test {
// EncryptWithNonce wraps the |Encrypt| method of |encrypter| to allow passing
// in an nonce and also to allocate the buffer needed for the ciphertext.
QuicData* EncryptWithNonce(ChaCha20Poly1305Encrypter* encrypter,
- StringPiece nonce,
- StringPiece associated_data,
- StringPiece plaintext) {
+ QuicStringPiece nonce,
+ QuicStringPiece associated_data,
+ QuicStringPiece plaintext) {
size_t ciphertext_size = encrypter->GetCiphertextSize(plaintext.length());
std::unique_ptr<char[]> ciphertext(new char[ciphertext_size]);
@@ -102,7 +101,7 @@ TEST(ChaCha20Poly1305EncrypterTest, EncryptThenDecrypt) {
ASSERT_TRUE(encrypter.EncryptPacket(QuicVersionMax(), packet_number,
associated_data, plaintext, encrypted,
&len, arraysize(encrypted)));
- StringPiece ciphertext(encrypted, len);
+ QuicStringPiece ciphertext(encrypted, len);
char decrypted[1024];
ASSERT_TRUE(decrypter.DecryptPacket(QuicVersionMax(), packet_number,
associated_data, ciphertext, decrypted,
@@ -125,7 +124,8 @@ TEST(ChaCha20Poly1305EncrypterTest, Encrypt) {
&encrypter, fixed + iv,
// This deliberately tests that the encrypter can handle an AAD that
// is set to nullptr, as opposed to a zero-length, non-nullptr pointer.
- StringPiece(aad.length() ? aad.data() : nullptr, aad.length()), pt));
+ QuicStringPiece(aad.length() ? aad.data() : nullptr, aad.length()),
+ pt));
ASSERT_TRUE(encrypted.get());
EXPECT_EQ(12u, ct.size() - pt.size());
EXPECT_EQ(12u, encrypted->length() - pt.size());
« no previous file with comments | « net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc ('k') | net/quic/core/crypto/channel_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698