OLD | NEW |
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 // Test of classes in tracked_time.cc | 5 // Test of classes in tracked_time.cc |
6 | 6 |
7 #include "base/profiler/tracked_time.h" | 7 #include "base/profiler/tracked_time.h" |
8 #include "base/time.h" | 8 #include "base/time/time.h" |
9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
11 | 11 |
12 namespace tracked_objects { | 12 namespace tracked_objects { |
13 | 13 |
14 TEST(TrackedTimeTest, TrackedTimerMilliseconds) { | 14 TEST(TrackedTimeTest, TrackedTimerMilliseconds) { |
15 // First make sure we basicallly transfer simple milliseconds values as | 15 // First make sure we basicallly transfer simple milliseconds values as |
16 // expected. Most critically, things should not become null. | 16 // expected. Most critically, things should not become null. |
17 int32 kSomeMilliseconds = 243; // Some example times. | 17 int32 kSomeMilliseconds = 243; // Some example times. |
18 int64 kReallyBigMilliseconds = (1LL << 35) + kSomeMilliseconds; | 18 int64 kReallyBigMilliseconds = (1LL << 35) + kSomeMilliseconds; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 EXPECT_FALSE(ticks_after.is_null()); | 101 EXPECT_FALSE(ticks_after.is_null()); |
102 | 102 |
103 // Now make sure that we bracketed our tracked time nicely. | 103 // Now make sure that we bracketed our tracked time nicely. |
104 Duration before = now - TrackedTime(ticks_before); | 104 Duration before = now - TrackedTime(ticks_before); |
105 EXPECT_LE(0, before.InMilliseconds()); | 105 EXPECT_LE(0, before.InMilliseconds()); |
106 Duration after = now - TrackedTime(ticks_after); | 106 Duration after = now - TrackedTime(ticks_after); |
107 EXPECT_GE(0, after.InMilliseconds()); | 107 EXPECT_GE(0, after.InMilliseconds()); |
108 } | 108 } |
109 | 109 |
110 } // namespace tracked_objects | 110 } // namespace tracked_objects |
OLD | NEW |