1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 tvcm.require('tvcm.guid');
8 tvcm.require('tvcm.unittest.constants');
10 tvcm.exportTo('tvcm.unittest', function() {
11 var TestTypes = tvcm.unittest.TestTypes;
13 function TestCase(suite, testType, name, test, options) {
14 this.guid_ = tvcm.GUID.allocate();
16 this.testType_ = testType;
19 this.options_ = options;
24 TestCase.parseFullyQualifiedName = function(fqn) {
25 var i = fqn.lastIndexOf('.');
27 throw new Error('FullyQualifiedNames must have a period in them');
29 suiteName: fqn.substr(0, i),
30 testCaseName: fqn.substr(i + 1)
34 TestCase.prototype = {
35 __proto__: Object.prototype,
46 return this.testType_;
53 get fullyQualifiedName() {
54 return this.suite_.name + '.' + this.name_;
61 run: function(htmlHook) {
65 // TODO(nduca): The routing of this is a bit awkward. Probably better
66 // to install a global function.
67 addHTMLOutput: function(element) {
68 tvcm.unittest.addHTMLOutputForCurrentTest(element);
72 function PerfTestCase(suite, name, test, options) {
73 TestCase.call(this, suite, TestTypes.PERFTEST, name, test, options);
76 PerfTestCase.prototype = {
77 __proto__: TestCase.prototype
82 PerfTestCase: PerfTestCase