| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style license that can be |
| found in the LICENSE file. |
| --> |
| |
| <link rel="import" href="/tracing/core/test_utils.html"> |
| <link rel="import" href="/tracing/extras/rail/idle_interaction_record.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tr.b.unittest.testSuite(function() { |
| var test_utils = tr.c.TestUtils; |
| |
| test('optimalEfficiency', function() { |
| var idleIR = new tr.e.rail.IdleInteractionRecord(undefined, 0, 150); |
| assert.equal(1, idleIR.normalizedUserComfort); |
| assert.equal(1, idleIR.normalizedEfficiency); |
| }); |
| |
| test('pessimalEfficiency', function() { |
| var slice = tr.c.TestUtils.newSliceEx({ |
| title: 'foo', |
| start: 0, |
| end: 150, |
| type: tr.model.ThreadSlice |
| }); |
| slice.isTopLevel = true; |
| slice.cpuSelfTime = 150; |
| |
| var idleIR = new tr.e.rail.IdleInteractionRecord(undefined, 0, 150); |
| idleIR.associatedEvents.push(slice); |
| |
| assert.equal(1, idleIR.normalizedUserComfort); |
| assert.equal(0, idleIR.normalizedEfficiency); |
| }); |
| }); |
| </script> |