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

Side by Side Diff: net/quic/test_tools/quic_test_utils.cc

Issue 2566783002: Various formatting cleanups to net/quic/crypto and net/quic/congestion_control (Closed)
Patch Set: Rebase 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 unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/test_tools/quic_test_utils.h" 5 #include "net/quic/test_tools/quic_test_utils.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 if (identical) 720 if (identical)
721 return; 721 return;
722 ADD_FAILURE() << "Description:\n" 722 ADD_FAILURE() << "Description:\n"
723 << description << "\n\nExpected:\n" 723 << description << "\n\nExpected:\n"
724 << HexDumpWithMarks(expected, expected_len, marks.get(), 724 << HexDumpWithMarks(expected, expected_len, marks.get(),
725 max_len) 725 max_len)
726 << "\nActual:\n" 726 << "\nActual:\n"
727 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len); 727 << HexDumpWithMarks(actual, actual_len, marks.get(), max_len);
728 } 728 }
729 729
730 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes) {
731 bytes->clear();
732 if (hex.empty())
733 return true;
734 std::vector<uint8_t> v;
735 if (!base::HexStringToBytes(hex.as_string(), &v))
736 return false;
737 if (!v.empty())
738 bytes->assign(reinterpret_cast<const char*>(&v[0]), v.size());
739 return true;
740 }
741
742 static QuicPacket* ConstructPacketFromHandshakeMessage( 730 static QuicPacket* ConstructPacketFromHandshakeMessage(
743 QuicConnectionId connection_id, 731 QuicConnectionId connection_id,
744 const CryptoHandshakeMessage& message, 732 const CryptoHandshakeMessage& message,
745 bool should_include_version) { 733 bool should_include_version) {
746 CryptoFramer crypto_framer; 734 CryptoFramer crypto_framer;
747 std::unique_ptr<QuicData> data( 735 std::unique_ptr<QuicData> data(
748 crypto_framer.ConstructHandshakeMessage(message)); 736 crypto_framer.ConstructHandshakeMessage(message));
749 QuicFramer quic_framer(AllSupportedVersions(), QuicTime::Zero(), 737 QuicFramer quic_framer(AllSupportedVersions(), QuicTime::Zero(),
750 Perspective::IS_CLIENT); 738 Perspective::IS_CLIENT);
751 739
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 // strike register worries that we've just overflowed a uint32_t time. 883 // strike register worries that we've just overflowed a uint32_t time.
896 (*server_connection)->AdvanceTime(connection_start_time); 884 (*server_connection)->AdvanceTime(connection_start_time);
897 } 885 }
898 886
899 QuicStreamId QuicClientDataStreamId(int i) { 887 QuicStreamId QuicClientDataStreamId(int i) {
900 return kClientDataStreamId1 + 2 * i; 888 return kClientDataStreamId1 + 2 * i;
901 } 889 }
902 890
903 } // namespace test 891 } // namespace test
904 } // namespace net 892 } // namespace net
OLDNEW
« no previous file with comments | « 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