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 TestParams p; |
| 254 p.local_lower_bound = 15; |
| 255 p.remote_lower_bound = 10; |
| 256 p.remote_upper_bound = 25; |
| 257 p.local_upper_bound = 20; |
| 258 |
| 259 p.test_time = 10; |
| 260 TestResults results = RunTest(p); |
| 261 EXPECT_EQ(15, results.result_time); |
| 262 |
| 263 p.test_time = 25; |
| 264 results = RunTest(p); |
| 265 EXPECT_EQ(20, results.result_time); |
| 266 |
| 267 p.test_time = 9; |
| 268 results = RunTest(p); |
| 269 EXPECT_EQ(14, results.result_time); |
| 270 |
| 271 p.test_time = 26; |
| 272 results = RunTest(p); |
| 273 EXPECT_EQ(31, results.result_time); |
| 274 } |
| 275 |
252 } // anonymous namespace | 276 } // anonymous namespace |
253 | 277 |
254 } // namespace content | 278 } // namespace content |
OLD | NEW |