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

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

Issue 2611613003: Add quic_logging (Closed)
Patch Set: fix failed test? Created 3 years, 11 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
« no previous file with comments | « net/quic/test_tools/simulator/queue.cc ('k') | net/quic/test_tools/simulator/simulator_test.cc » ('j') | 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 "base/memory/ptr_util.h" 5 #include "base/memory/ptr_util.h"
6 #include "net/quic/core/crypto/quic_random.h" 6 #include "net/quic/core/crypto/quic_random.h"
7 #include "net/quic/platform/api/quic_logging.h"
7 #include "net/quic/test_tools/simulator/simulator.h" 8 #include "net/quic/test_tools/simulator/simulator.h"
8 9
9 namespace net { 10 namespace net {
10 namespace simulator { 11 namespace simulator {
11 12
12 Simulator::Simulator() 13 Simulator::Simulator()
13 : random_generator_(nullptr), 14 : random_generator_(nullptr),
14 alarm_factory_(this, "Default Alarm Manager"), 15 alarm_factory_(this, "Default Alarm Manager"),
15 run_for_should_stop_(false), 16 run_for_should_stop_(false),
16 enable_random_delays_(false) { 17 enable_random_delays_(false) {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 bool simulation_result = RunUntil([this]() { return run_for_should_stop_; }); 121 bool simulation_result = RunUntil([this]() { return run_for_should_stop_; });
121 122
122 DCHECK(simulation_result); 123 DCHECK(simulation_result);
123 DCHECK(clock_.Now() == end_time); 124 DCHECK(clock_.Now() == end_time);
124 } 125 }
125 126
126 void Simulator::HandleNextScheduledActor() { 127 void Simulator::HandleNextScheduledActor() {
127 const auto current_event_it = schedule_.begin(); 128 const auto current_event_it = schedule_.begin();
128 QuicTime event_time = current_event_it->first; 129 QuicTime event_time = current_event_it->first;
129 Actor* actor = current_event_it->second; 130 Actor* actor = current_event_it->second;
130 DVLOG(3) << "At t = " << event_time.ToDebuggingValue() << ", calling " 131 QUIC_DVLOG(3) << "At t = " << event_time.ToDebuggingValue() << ", calling "
131 << actor->name(); 132 << actor->name();
132 133
133 Unschedule(actor); 134 Unschedule(actor);
134 135
135 if (clock_.Now() > event_time) { 136 if (clock_.Now() > event_time) {
136 QUIC_BUG << "Error: event registered by [" << actor->name() 137 QUIC_BUG << "Error: event registered by [" << actor->name()
137 << "] requires travelling back in time. Current time: " 138 << "] requires travelling back in time. Current time: "
138 << clock_.Now().ToDebuggingValue() 139 << clock_.Now().ToDebuggingValue()
139 << ", scheduled time: " << event_time.ToDebuggingValue(); 140 << ", scheduled time: " << event_time.ToDebuggingValue();
140 } 141 }
141 clock_.now_ = event_time; 142 clock_.now_ = event_time;
142 143
143 actor->Act(); 144 actor->Act();
144 } 145 }
145 146
146 } // namespace simulator 147 } // namespace simulator
147 } // namespace net 148 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/simulator/queue.cc ('k') | net/quic/test_tools/simulator/simulator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698