| Index: tracing/tracing/metrics/system_health/hazard_metric_test.html
|
| diff --git a/tracing/tracing/metrics/system_health/hazard_metric_test.html b/tracing/tracing/metrics/system_health/hazard_metric_test.html
|
| index b73d8fb40080e990505568cffd93300e16173d3b..3a393542cc1faf292b200f3f94483f0b3c745ad4 100644
|
| --- a/tracing/tracing/metrics/system_health/hazard_metric_test.html
|
| +++ b/tracing/tracing/metrics/system_health/hazard_metric_test.html
|
| @@ -9,7 +9,6 @@ found in the LICENSE file.
|
| <link rel="import"
|
| href="/tracing/metrics/system_health/hazard_metric.html">
|
| <link rel="import" href="/tracing/metrics/value_set.html">
|
| -<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
|
|
|
| <script>
|
| 'use strict';
|
| @@ -17,6 +16,10 @@ found in the LICENSE file.
|
| tr.b.unittest.testSuite(function() {
|
| function computeHazardValue(customizeModelCallback) {
|
| var model = tr.c.TestUtils.newModel(function(model) {
|
| + model.rendererProcess = model.getOrCreateProcess(2);
|
| + model.rendererMain = model.rendererProcess.getOrCreateThread(3);
|
| + model.rendererMain.name = 'CrRendererMain';
|
| +
|
| customizeModelCallback(model);
|
| });
|
| var values = new tr.metrics.ValueSet();
|
| @@ -29,10 +32,7 @@ tr.b.unittest.testSuite(function() {
|
| test('minimalHazard', function() {
|
| var duration = 50 + 1e-4;
|
| var value = computeHazardValue(function(model) {
|
| - var idle = new tr.model.um.IdleExpectation(
|
| - model, 'test', 0, 10000);
|
| - model.userModel.expectations.push(idle);
|
| - idle.associatedEvents.push(tr.c.TestUtils.newSliceEx({
|
| + model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
|
| type: tr.model.ThreadSlice,
|
| isTopLevel: true,
|
| start: 0,
|
| @@ -40,58 +40,49 @@ tr.b.unittest.testSuite(function() {
|
| }));
|
| });
|
| assert.notEqual(0, value.numeric.value);
|
| - assert.closeTo(value.numeric.value, 0, 1e-5);
|
| + assert.closeTo(value.numeric.value, 0.1611, 1e-5);
|
| });
|
|
|
| test('maximalHazard', function() {
|
| var value = computeHazardValue(function(model) {
|
| - var idle = new tr.model.um.IdleExpectation(
|
| - model, 'test', 0, 10000);
|
| - model.userModel.expectations.push(idle);
|
| - idle.associatedEvents.push(tr.c.TestUtils.newSliceEx({
|
| + model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
|
| type: tr.model.ThreadSlice,
|
| isTopLevel: true,
|
| start: 0,
|
| duration: 2200
|
| }));
|
| });
|
| - assert.equal(value.numeric.value, 1);
|
| + assert.closeTo(value.numeric.value, 1, 1e-5);
|
| });
|
|
|
| test('blendedHazards', function() {
|
| var value = computeHazardValue(function(model) {
|
| - var idle = new tr.model.um.IdleExpectation(
|
| - model, 'test', 0, 10000);
|
| - model.userModel.expectations.push(idle);
|
| - idle.associatedEvents.push(tr.c.TestUtils.newSliceEx({
|
| + model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
|
| type: tr.model.ThreadSlice,
|
| isTopLevel: true,
|
| start: 0,
|
| duration: 100
|
| }));
|
| - idle.associatedEvents.push(tr.c.TestUtils.newSliceEx({
|
| + model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
|
| type: tr.model.ThreadSlice,
|
| isTopLevel: true,
|
| start: 0,
|
| duration: 200
|
| }));
|
| - idle = new tr.model.um.IdleExpectation(
|
| - model, 'test', 0, 10000);
|
| - model.userModel.expectations.push(idle);
|
| - idle.associatedEvents.push(tr.c.TestUtils.newSliceEx({
|
| + model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
|
| type: tr.model.ThreadSlice,
|
| isTopLevel: true,
|
| start: 0,
|
| duration: 300
|
| }));
|
| - idle.associatedEvents.push(tr.c.TestUtils.newSliceEx({
|
| + model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
|
| type: tr.model.ThreadSlice,
|
| isTopLevel: true,
|
| start: 0,
|
| duration: 400
|
| }));
|
| });
|
| - assert.closeTo(0.5454, value.numeric.value, 1e-3);
|
| + assert.closeTo(0.92144, value.numeric.value, 1e-4);
|
| });
|
| });
|
| </script>
|
|
|