summaryrefslogtreecommitdiff
path: root/chromium/third_party/catapult/tracing/tracing/base/utils_test.html
blob: 8e7c91a7fceb57231f766e86c90dc45b4e7ccc64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<!--
Copyright (c) 2014 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">

<script>
'use strict';

tr.b.unittest.testSuite(function() {
  test('getUsingPath', function() {
    var z = tr.b.getUsingPath('x.y.z', {'x': {'y': {'z': 3}}});
    assert.equal(z, 3);

    var w = tr.b.getUsingPath('x.w', {'x': {'y': {'z': 3}}});
    assert.isUndefined(w);
  });

  test('testExceptionNaming', function() {
    var err = new Error('asdf');
    err.name = 'MyError';

    var ex = tr.b.normalizeException(err);
    assert.equal(ex.typeName, 'MyError');
  });

  test('formatDate', function() {
    assert.strictEqual(tr.b.formatDate(new Date(0)), '1970-01-01 00:00:00');
  });
});
</script>