OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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/extras/rail/response_interaction_record.html"> | 8 <link rel="import" href="/tracing/extras/rail/response_interaction_record.html"> |
9 | 9 |
10 <script> | 10 <script> |
11 'use strict'; | 11 'use strict'; |
12 | 12 |
13 tr.b.unittest.testSuite(function() { | 13 tr.b.unittest.testSuite(function() { |
14 var test_utils = tr.c.TestUtils; | 14 var test_utils = tr.c.TestUtils; |
15 | 15 |
16 test('instantiate', function() { | 16 test('instantiate', function() { |
17 var responseIR = new tr.e.rail.ResponseInteractionRecord(0, 150); | 17 var responseIR = new tr.e.rail.ResponseInteractionRecord(0, 150); |
18 assert.equal(0, responseIR.normalizedUserPain); | 18 assert.equal(1, responseIR.normalizedUserComfort); |
19 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 150.0001); | 19 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 150.0001); |
20 assert.closeTo(0, responseIR.normalizedUserPain, 1e-5); | 20 assert.closeTo(1, responseIR.normalizedUserComfort, 1e-5); |
| 21 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 299.9999); |
| 22 assert.closeTo(0.8, responseIR.normalizedUserComfort, 1e-5); |
| 23 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 300.0001); |
| 24 assert.closeTo(0.8, responseIR.normalizedUserComfort, 1e-5); |
| 25 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 999.9999); |
| 26 assert.closeTo(0.1, responseIR.normalizedUserComfort, 1e-5); |
| 27 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 1000.0001); |
| 28 assert.closeTo(0.1, responseIR.normalizedUserComfort, 1e-5); |
21 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 4999.999); | 29 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 4999.999); |
22 assert.closeTo(1, responseIR.normalizedUserPain, 1e-5); | 30 assert.closeTo(0, responseIR.normalizedUserComfort, 1e-5); |
23 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 5000); | 31 responseIR = new tr.e.rail.ResponseInteractionRecord(0, 5000); |
24 assert.equal(1, responseIR.normalizedUserPain); | 32 assert.equal(0, responseIR.normalizedUserComfort); |
25 }); | 33 }); |
26 }); | 34 }); |
27 </script> | 35 </script> |
OLD | NEW |