| <!DOCTYPE html> |
| <!-- |
| Copyright (c) 2013 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/base/utils.html"> |
| <link rel="import" href="/perf_insights/value/value.html"> |
| <link rel="import" href="/perf_insights/value/run_info.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tr.b.unittest.testSuite(function() { |
| test('dictValueBasic', function() { |
| var runInfo = new pi.v.RunInfo('my_test.json'); |
| var v = new pi.v.DictValue(runInfo, 'MyFailure', |
| {my_key: 'my_value'}); |
| var d = v.asDict(); |
| |
| var v2 = pi.v.Value.fromDict(runInfo, d); |
| assert.instanceOf(v2, pi.v.DictValue); |
| assert.equal(v.name, v2.name); |
| assert.deepEqual(v.value, v2.value); |
| }); |
| |
| test('failureValueBasic', function() { |
| var runInfo = new pi.v.RunInfo('my_test.json'); |
| var v = new pi.v.FailureValue(runInfo, 'MyFailure', |
| {description: 'Description', |
| stack: tr.b.stackTraceAsString()}); |
| var d = v.asDict(); |
| |
| var v2 = pi.v.Value.fromDict(runInfo, d); |
| assert.instanceOf(v2, pi.v.FailureValue); |
| assert.equal(v.name, v2.name); |
| assert.equal(v.description, v2.description); |
| assert.equal(v.stack, v2.stack); |
| }); |
| |
| test('skipValueBasic', function() { |
| var runInfo = new pi.v.RunInfo('my_test.json'); |
| var v = new pi.v.SkipValue(runInfo, 'MySkip', |
| {description: 'WhySkipped'}); |
| var d = v.asDict(); |
| |
| var v2 = pi.v.Value.fromDict(runInfo, d); |
| assert.instanceOf(v2, pi.v.SkipValue); |
| assert.equal(v.name, v2.name); |
| assert.equal(v.description, v2.description); |
| }); |
| |
| }); |
| |
| </script> |