OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 virtual void Start() OVERRIDE { | 128 virtual void Start() OVERRIDE { |
129 base::TimeDelta time_to_wait; | 129 base::TimeDelta time_to_wait; |
130 start_time_ = base::TimeTicks::Now(); | 130 start_time_ = base::TimeTicks::Now(); |
131 if (!load_timing_deltas_.receive_headers_end.is_null()) { | 131 if (!load_timing_deltas_.receive_headers_end.is_null()) { |
132 // Need to delay starting until the largest of the times has elapsed. | 132 // Need to delay starting until the largest of the times has elapsed. |
133 // Wait a little longer than necessary, to be on the safe side. | 133 // Wait a little longer than necessary, to be on the safe side. |
134 time_to_wait = load_timing_deltas_.receive_headers_end.GetDelta() + | 134 time_to_wait = load_timing_deltas_.receive_headers_end.GetDelta() + |
135 base::TimeDelta::FromMilliseconds(100); | 135 base::TimeDelta::FromMilliseconds(100); |
136 } | 136 } |
137 | 137 |
138 MessageLoop::current()->PostDelayedTask( | 138 base::MessageLoop::current()->PostDelayedTask( |
139 FROM_HERE, | 139 FROM_HERE, |
140 base::Bind(&MockUrlRequestJobWithTiming::DelayedStart, | 140 base::Bind(&MockUrlRequestJobWithTiming::DelayedStart, |
141 weak_factory_.GetWeakPtr()), | 141 weak_factory_.GetWeakPtr()), |
142 time_to_wait); | 142 time_to_wait); |
143 } | 143 } |
144 | 144 |
145 virtual void GetLoadTimingInfo( | 145 virtual void GetLoadTimingInfo( |
146 net::LoadTimingInfo* load_timing_info) const OVERRIDE { | 146 net::LoadTimingInfo* load_timing_info) const OVERRIDE { |
147 // Make sure enough time has elapsed since start was called. If this | 147 // Make sure enough time has elapsed since start was called. If this |
148 // fails, the test fixture itself is flaky. | 148 // fails, the test fixture itself is flaky. |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 navigation_deltas.send_start.GetDelta()); | 586 navigation_deltas.send_start.GetDelta()); |
587 // The only times that are guaranteed to be distinct are send_start and | 587 // The only times that are guaranteed to be distinct are send_start and |
588 // received_headers_end. | 588 // received_headers_end. |
589 EXPECT_LT(navigation_deltas.send_start.GetDelta(), | 589 EXPECT_LT(navigation_deltas.send_start.GetDelta(), |
590 navigation_deltas.receive_headers_end.GetDelta()); | 590 navigation_deltas.receive_headers_end.GetDelta()); |
591 | 591 |
592 EXPECT_TRUE(navigation_deltas.ssl_start.is_null()); | 592 EXPECT_TRUE(navigation_deltas.ssl_start.is_null()); |
593 } | 593 } |
594 | 594 |
595 } // namespace | 595 } // namespace |
OLD | NEW |