OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/inter_process_time_ticks_converter.h" | 5 #include "content/common/inter_process_time_ticks_converter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 p.remote_lower_bound = 30; | 242 p.remote_lower_bound = 30; |
243 p.remote_upper_bound = 41; | 243 p.remote_upper_bound = 41; |
244 p.local_upper_bound = 20; | 244 p.local_upper_bound = 20; |
245 p.test_time = 41; | 245 p.test_time = 41; |
246 p.test_delta = 0; | 246 p.test_delta = 0; |
247 TestResults results = RunTest(p); | 247 TestResults results = RunTest(p); |
248 EXPECT_EQ(20, results.result_time); | 248 EXPECT_EQ(20, results.result_time); |
249 EXPECT_EQ(0, results.result_delta); | 249 EXPECT_EQ(0, results.result_delta); |
250 } | 250 } |
251 | 251 |
| 252 TEST(InterProcessTimeTicksConverterTest, ValuesOutsideOfRange) { |
| 253 InterProcessTimeTicksConverter converter( |
| 254 LocalTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(15)), |
| 255 LocalTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(20)), |
| 256 RemoteTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(10)), |
| 257 RemoteTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(25))); |
| 258 |
| 259 RemoteTimeTicks remote_ticks = |
| 260 RemoteTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(10)); |
| 261 int64_t result = |
| 262 converter.ToLocalTimeTicks(remote_ticks).ToTimeTicks().ToInternalValue(); |
| 263 EXPECT_EQ(15, result); |
| 264 |
| 265 remote_ticks = |
| 266 RemoteTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(25)); |
| 267 result = |
| 268 converter.ToLocalTimeTicks(remote_ticks).ToTimeTicks().ToInternalValue(); |
| 269 EXPECT_EQ(20, result); |
| 270 |
| 271 remote_ticks = |
| 272 RemoteTimeTicks::FromTimeTicks(TimeTicks::FromInternalValue(9)); |
| 273 result = |
| 274 converter.ToLocalTimeTicks(remote_ticks).ToTimeTicks().ToInternalValue(); |
| 275 EXPECT_EQ(14, result); |
| 276 } |
| 277 |
252 } // anonymous namespace | 278 } // anonymous namespace |
253 | 279 |
254 } // namespace content | 280 } // namespace content |
OLD | NEW |