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

Unified Diff: net/socket/socket_test_util.cc

Issue 10795012: Modify DeterministicSocketData to verify that the sequence number of reads and writes start at zero… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix rebase problem. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/spdy/spdy_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.cc
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index ff66830230ad73c2efb139795a2f191a7812f667..34af3709c8d5b6b509965b066e2f0a76fb22c95a 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -450,6 +450,7 @@ DeterministicSocketData::DeterministicSocketData(MockRead* reads,
stopping_sequence_number_(0),
stopped_(false),
print_debug_(false) {
+ VerifyCorrectSequenceNumbers(reads, reads_count, writes, writes_count);
}
DeterministicSocketData::~DeterministicSocketData() {}
@@ -603,6 +604,32 @@ void DeterministicSocketData::NextStep() {
SetStopped(true);
}
+void DeterministicSocketData::VerifyCorrectSequenceNumbers(
+ MockRead* reads, size_t reads_count,
+ MockWrite* writes, size_t writes_count) {
+ size_t read = 0;
+ size_t write = 0;
+ int expected = 0;
+ while (read < reads_count || write < writes_count) {
+ // Check to see that we have a read or write at the expected
+ // state.
+ if (read < reads_count && reads[read].sequence_number == expected) {
+ ++read;
+ ++expected;
+ continue;
+ }
+ if (write < writes_count && writes[write].sequence_number == expected) {
+ ++write;
+ ++expected;
+ continue;
+ }
+ NOTREACHED() << "Missing sequence number: " << expected;
+ return;
+ }
+ DCHECK_EQ(read, reads_count);
+ DCHECK_EQ(write, writes_count);
+}
+
MockClientSocketFactory::MockClientSocketFactory() {}
MockClientSocketFactory::~MockClientSocketFactory() {}
« no previous file with comments | « net/socket/socket_test_util.h ('k') | net/spdy/spdy_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698