| 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/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/googletest/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; |
| 19 | 19 |
| 20 TrackedTime some = TrackedTime() + | 20 TrackedTime some = TrackedTime() + |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 EXPECT_FALSE(ticks_after.is_null()); | 94 EXPECT_FALSE(ticks_after.is_null()); |
| 95 | 95 |
| 96 // Now make sure that we bracketed our tracked time nicely. | 96 // Now make sure that we bracketed our tracked time nicely. |
| 97 Duration before = now - TrackedTime(ticks_before); | 97 Duration before = now - TrackedTime(ticks_before); |
| 98 EXPECT_LE(0, before.InMilliseconds()); | 98 EXPECT_LE(0, before.InMilliseconds()); |
| 99 Duration after = now - TrackedTime(ticks_after); | 99 Duration after = now - TrackedTime(ticks_after); |
| 100 EXPECT_GE(0, after.InMilliseconds()); | 100 EXPECT_GE(0, after.InMilliseconds()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace tracked_objects | 103 } // namespace tracked_objects |
| OLD | NEW |