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

Unified Diff: net/quic/test_tools/quic_test_utils.cc

Issue 54043003: Remove some duplicate code in quic tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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/test_tools/quic_test_utils.cc
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index dd415264d6e4fa704b5f0a7b27814c552cb0c7f6..34de8935426ecd1473b0909008374260b7a7930b 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -5,6 +5,7 @@
#include "net/quic/test_tools/quic_test_utils.h"
#include "base/stl_util.h"
+#include "base/strings/string_number_conversions.h"
#include "net/quic/crypto/crypto_framer.h"
#include "net/quic/crypto/crypto_handshake.h"
#include "net/quic/crypto/crypto_utils.h"
@@ -386,6 +387,18 @@ void CompareCharArraysWithHexError(
<< HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
}
+bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
+ *bytes = string();
wtc 2013/11/04 01:58:27 Nit: would bytes->clear() be better?
eroman 2013/11/04 19:39:58 Done.
+ if (hex.empty())
+ return true;
+ std::vector<uint8> v;
+ if (!base::HexStringToBytes(hex.as_string(), &v))
+ return false;
+ if (!v.empty())
+ *bytes = string(reinterpret_cast<const char*>(&v[0]), v.size());
wtc 2013/11/04 01:58:27 Nit: this probably can be a bytes->append() call.
eroman 2013/11/04 19:39:58 Done (using assign()).
+ return true;
+}
+
static QuicPacket* ConstructPacketFromHandshakeMessage(
QuicGuid guid,
const CryptoHandshakeMessage& message,
« net/quic/crypto/channel_id_test.cc ('K') | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698