| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/trace_event/trace_event_synthetic_delay.h" | 5 #include "base/trace_event/trace_event_synthetic_delay.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 namespace debug { | 10 namespace trace_event { |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 const int kTargetDurationMs = 100; | 13 const int kTargetDurationMs = 100; |
| 14 // Allow some leeway in timings to make it possible to run these tests with a | 14 // Allow some leeway in timings to make it possible to run these tests with a |
| 15 // wall clock time source too. | 15 // wall clock time source too. |
| 16 const int kShortDurationMs = 10; | 16 const int kShortDurationMs = 10; |
| 17 | 17 |
| 18 } // namespace | 18 } // namespace |
| 19 | 19 |
| 20 class TraceEventSyntheticDelayTest : public testing::Test, | 20 class TraceEventSyntheticDelayTest : public testing::Test, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 EXPECT_FALSE(end_times[1].is_null()); | 143 EXPECT_FALSE(end_times[1].is_null()); |
| 144 | 144 |
| 145 delay->EndParallel(end_times[0]); | 145 delay->EndParallel(end_times[0]); |
| 146 EXPECT_GE((Now() - start_time).InMilliseconds(), kTargetDurationMs); | 146 EXPECT_GE((Now() - start_time).InMilliseconds(), kTargetDurationMs); |
| 147 | 147 |
| 148 start_time = Now(); | 148 start_time = Now(); |
| 149 delay->EndParallel(end_times[1]); | 149 delay->EndParallel(end_times[1]); |
| 150 EXPECT_LT((Now() - start_time).InMilliseconds(), kShortDurationMs); | 150 EXPECT_LT((Now() - start_time).InMilliseconds(), kShortDurationMs); |
| 151 } | 151 } |
| 152 | 152 |
| 153 } // namespace debug | 153 } // namespace trace_event |
| 154 } // namespace base | 154 } // namespace base |
| OLD | NEW |