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

Side by Side Diff: net/tools/quic/quic_dispatcher_test.cc

Issue 2678973002: Replace va_arg version of crypto_test_utils::Message with a more modern vector argument version. (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 CreateSessionBasedOnTestParams(connection_id, client_address))); 812 CreateSessionBasedOnTestParams(connection_id, client_address)));
813 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 813 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
814 ProcessUdpPacket(_, _, _)) 814 ProcessUdpPacket(_, _, _))
815 .WillOnce(testing::WithArgs<2>(Invoke(CreateFunctor( 815 .WillOnce(testing::WithArgs<2>(Invoke(CreateFunctor(
816 &QuicDispatcherTest::ValidatePacket, base::Unretained(this), 1)))); 816 &QuicDispatcherTest::ValidatePacket, base::Unretained(this), 1))));
817 } 817 }
818 818
819 QUIC_LOG(INFO) << "ExpectStatelessReject: " << ExpectStatelessReject(); 819 QUIC_LOG(INFO) << "ExpectStatelessReject: " << ExpectStatelessReject();
820 QUIC_LOG(INFO) << "Params: " << GetParam(); 820 QUIC_LOG(INFO) << "Params: " << GetParam();
821 // Process the first packet for the connection. 821 // Process the first packet for the connection.
822 // clang-format off 822 CryptoHandshakeMessage client_hello =
823 CryptoHandshakeMessage client_hello = crypto_test_utils::Message( 823 crypto_test_utils::CreateCHLO({{"AEAD", "AESG"},
824 "CHLO", 824 {"KEXS", "C255"},
825 "AEAD", "AESG", 825 {"COPT", "SREJ"},
826 "KEXS", "C255", 826 {"NONC", "1234567890123456789012"},
827 "COPT", "SREJ", 827 {"VER\0", "Q025"}},
828 "NONC", "1234567890123456789012", 828 kClientHelloMinimumSize);
829 "VER\0", "Q025",
830 "$padding", static_cast<int>(kClientHelloMinimumSize),
831 nullptr);
832 // clang-format on
833 829
834 ProcessPacket(client_address, connection_id, true, false, 830 ProcessPacket(client_address, connection_id, true, false,
835 client_hello.GetSerialized().AsStringPiece().as_string()); 831 client_hello.GetSerialized().AsStringPiece().as_string());
836 832
837 if (GetParam().enable_stateless_rejects_via_flag) { 833 if (GetParam().enable_stateless_rejects_via_flag) {
838 EXPECT_EQ(true, 834 EXPECT_EQ(true,
839 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); 835 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
840 } 836 }
841 } 837 }
842 838
843 TEST_P(QuicDispatcherStatelessRejectTest, BufferNonChlo) { 839 TEST_P(QuicDispatcherStatelessRejectTest, BufferNonChlo) {
844 FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true; 840 FLAGS_quic_reloadable_flag_quic_use_cheap_stateless_rejects = true;
845 CreateTimeWaitListManager(); 841 CreateTimeWaitListManager();
846 842
847 const QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); 843 const QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1);
848 const QuicConnectionId connection_id = 1; 844 const QuicConnectionId connection_id = 1;
849 845
850 ProcessPacket(client_address, connection_id, true, false, 846 ProcessPacket(client_address, connection_id, true, false,
851 "NOT DATA FOR A CHLO"); 847 "NOT DATA FOR A CHLO");
852 848
853 // Process the first packet for the connection. 849 // Process the first packet for the connection.
854 // clang-format off 850 CryptoHandshakeMessage client_hello =
855 CryptoHandshakeMessage client_hello = crypto_test_utils::Message( 851 crypto_test_utils::CreateCHLO({{"AEAD", "AESG"},
856 "CHLO", 852 {"KEXS", "C255"},
857 "AEAD", "AESG", 853 {"NONC", "1234567890123456789012"},
858 "KEXS", "C255", 854 {"VER\0", "Q025"}},
859 "NONC", "1234567890123456789012", 855 kClientHelloMinimumSize);
860 "VER\0", "Q025",
861 "$padding", static_cast<int>(kClientHelloMinimumSize),
862 nullptr);
863 // clang-format on
864 856
865 // If stateless rejects are enabled then a connection will be created now 857 // If stateless rejects are enabled then a connection will be created now
866 // and the buffered packet will be processed 858 // and the buffered packet will be processed
867 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address)) 859 EXPECT_CALL(*dispatcher_, CreateQuicSession(connection_id, client_address))
868 .WillOnce(testing::Return( 860 .WillOnce(testing::Return(
869 CreateSessionBasedOnTestParams(connection_id, client_address))); 861 CreateSessionBasedOnTestParams(connection_id, client_address)));
870 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()), 862 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
871 ProcessUdpPacket(_, client_address, _)) 863 ProcessUdpPacket(_, client_address, _))
872 .WillOnce(testing::WithArg<2>( 864 .WillOnce(testing::WithArg<2>(
873 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket, 865 Invoke(CreateFunctor(&QuicDispatcherTest::ValidatePacket,
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 check.Call(2); 2074 check.Call(2);
2083 GetFakeProofSource()->InvokePendingCallback(0); 2075 GetFakeProofSource()->InvokePendingCallback(0);
2084 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0); 2076 ASSERT_EQ(GetFakeProofSource()->NumPendingCallbacks(), 0);
2085 EXPECT_FALSE(store->HasBufferedPackets(conn_id)); 2077 EXPECT_FALSE(store->HasBufferedPackets(conn_id));
2086 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id)); 2078 EXPECT_FALSE(time_wait_list_manager_->IsConnectionIdInTimeWait(conn_id));
2087 } 2079 }
2088 2080
2089 } // namespace 2081 } // namespace
2090 } // namespace test 2082 } // namespace test
2091 } // namespace net 2083 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/crypto_test_utils_test.cc ('k') | net/tools/quic/stateless_rejector_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698