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

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

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: sync Created 4 years 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/crypto_framer.cc ('k') | net/quic/core/quic_bandwidth_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/crypto/local_strike_register_client_test.cc
diff --git a/net/quic/core/crypto/local_strike_register_client_test.cc b/net/quic/core/crypto/local_strike_register_client_test.cc
index ee2ca16c9a1ffa5941e6171adca2c64ab202e5fe..684f9bd106ef2ef96930f04c067e52b776ff3b9e 100644
--- a/net/quic/core/crypto/local_strike_register_client_test.cc
+++ b/net/quic/core/crypto/local_strike_register_client_test.cc
@@ -11,6 +11,7 @@
#include "base/sys_byteorder.h"
#include "net/quic/core/crypto/crypto_protocol.h"
#include "net/quic/core/quic_time.h"
+#include "net/quic/platform/api/quic_str_cat.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::StringPiece;
@@ -83,8 +84,9 @@ TEST_F(LocalStrikeRegisterClientTest, IncorrectNonceLength) {
string valid_nonce;
uint32_t norder = base::HostToNet32(kCurrentTimeExternalSecs);
valid_nonce.assign(reinterpret_cast<const char*>(&norder), sizeof(norder));
- valid_nonce.append(string(reinterpret_cast<const char*>(kOrbit), kOrbitSize));
- valid_nonce.append(string(20, '\x17')); // 20 'random' bytes.
+ valid_nonce = QuicStrCat(
+ valid_nonce, string(reinterpret_cast<const char*>(kOrbit), kOrbitSize),
+ string(20, '\x17')); // 20 'random' bytes.
{
// Validation fails if you remove a byte from the nonce.
@@ -105,8 +107,7 @@ TEST_F(LocalStrikeRegisterClientTest, IncorrectNonceLength) {
bool called = false;
bool is_valid = false;
InsertStatus nonce_error = NONCE_UNKNOWN_FAILURE;
- string long_nonce(valid_nonce);
- long_nonce.append("a");
+ string long_nonce = QuicStrCat(valid_nonce, "a");
strike_register_->VerifyNonceIsValidAndUnique(
long_nonce, QuicWallTime::FromUNIXSeconds(kCurrentTimeExternalSecs),
new RecordResultCallback(&called, &is_valid, &nonce_error));
« no previous file with comments | « net/quic/core/crypto/crypto_framer.cc ('k') | net/quic/core/quic_bandwidth_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698