Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/base/assert_utils.html"> | 8 <link rel="import" href="/tracing/base/assert_utils.html"> |
| 9 <link rel="import" href="/tracing/core/test_utils.html"> | 9 <link rel="import" href="/tracing/core/test_utils.html"> |
| 10 <link rel="import" href="/tracing/extras/chrome/estimated_input_latency.html"> | 10 <link rel="import" href="/tracing/extras/chrome/estimated_input_latency.html"> |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 assert.closeTo(3 / 100 * 1 / 2 + 20 / 100 * 20 / 2, | 295 assert.closeTo(3 / 100 * 1 / 2 + 20 / 100 * 20 / 2, |
| 296 maxExpectedQueueingTimeInSlidingWindow(0, 1000, 100, | 296 maxExpectedQueueingTimeInSlidingWindow(0, 1000, 100, |
| 297 [{start: -10, end: 1}, | 297 [{start: -10, end: 1}, |
| 298 {start: 1, end: 2}, | 298 {start: 1, end: 2}, |
| 299 {start: 2, end: 3}, | 299 {start: 2, end: 3}, |
| 300 {start: 80, end: 100}, | 300 {start: 80, end: 100}, |
| 301 {start: 999, end: 1099}, | 301 {start: 999, end: 1099}, |
| 302 ]), | 302 ]), |
| 303 1e-6); | 303 1e-6); |
| 304 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 10, 100, | 304 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 10, 100, |
| 305 [{start: 0, end: 100}])); | 305 [{start: 0, end: 100}]), |
| 306 'The sliding window must fit in the specified time range' | |
| 307 ); | |
| 306 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 10, 0, | 308 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 10, 0, |
| 307 [{start: 0, end: 100}])); | 309 [{start: 0, end: 100}]), |
| 310 'The window size must be positive number' | |
| 311 ); | |
| 308 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 100, 10, | 312 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 100, 10, |
| 309 [{start: 0, end: 100}, {start: 99, end: 101}])); | 313 [{start: 0, end: 100}, {start: 99, end: 101}]), |
| 314 'Tasks must not overlap' | |
| 315 ); | |
| 316 // Allow small floating-point precision error when comparing task | |
| 317 // end-points for overlaping. | |
| 318 assert.closeTo((100.0001 + 0.0001) / 2, | |
|
charliea (OOO until 10-5)
2017/02/24 21:22:01
General comment: there are a bunch of different be
ulan
2017/02/24 21:28:11
Thank you. As discussed online, I'll refactor this
| |
| 319 maxExpectedQueueingTimeInSlidingWindow(0, 1000, 100, | |
| 320 [{start: 0, end: 100.0001}, {start: 100.0, end: 200}]), | |
| 321 1e-6); | |
| 322 // Overlap larger than 1e-3 should trigger exception. | |
| 323 assert.throws(() => maxExpectedQueueingTimeInSlidingWindow(0, 100, 10, | |
| 324 [{start: 0, end: 100.0011}, {start: 100.0, end: 101}]), | |
| 325 'Tasks must not overlap' | |
| 326 ); | |
| 310 }); | 327 }); |
| 311 }); | 328 }); |
| 312 </script> | 329 </script> |
| OLD | NEW |