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, |