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

Unified Diff: net/quic/core/crypto/chacha20_poly1305_decrypter_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
Index: net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
diff --git a/net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc b/net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
index aa766dbb21468533b3f6fd1c179a4a1235452232..a24d5315187e7769881ee5b2571f75d676204092 100644
--- a/net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
+++ b/net/quic/core/crypto/chacha20_poly1305_decrypter_test.cc
@@ -10,7 +10,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 {
@@ -114,11 +113,12 @@ namespace test {
// DecryptWithNonce wraps the |Decrypt| method of |decrypter| to allow passing
// in an nonce and also to allocate the buffer needed for the plaintext.
QuicData* DecryptWithNonce(ChaCha20Poly1305Decrypter* decrypter,
- StringPiece nonce,
- StringPiece associated_data,
- StringPiece ciphertext) {
+ QuicStringPiece nonce,
+ QuicStringPiece associated_data,
+ QuicStringPiece ciphertext) {
QuicPacketNumber packet_number;
- StringPiece nonce_prefix(nonce.data(), nonce.size() - sizeof(packet_number));
+ QuicStringPiece nonce_prefix(nonce.data(),
+ nonce.size() - sizeof(packet_number));
decrypter->SetNoncePrefix(nonce_prefix);
memcpy(&packet_number, nonce.data() + nonce_prefix.size(),
sizeof(packet_number));
@@ -155,7 +155,8 @@ TEST(ChaCha20Poly1305DecrypterTest, Decrypt) {
&decrypter, fixed + iv,
// This deliberately tests that the decrypter 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()), ct));
+ QuicStringPiece(aad.length() ? aad.data() : nullptr, aad.length()),
+ ct));
if (!decrypted.get()) {
EXPECT_FALSE(has_pt);
continue;
« no previous file with comments | « net/quic/core/crypto/cert_compressor_test.cc ('k') | net/quic/core/crypto/chacha20_poly1305_encrypter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698