Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function() { | 5 (function() { |
| 6 | 6 |
| 7 'use strict'; | 7 'use strict'; |
| 8 | 8 |
| 9 QUnit.module('error', { | 9 QUnit.module('error', { |
| 10 setup: function() { | 10 beforeEach: function() { |
| 11 }, | 11 }, |
| 12 teardown: function() { | 12 afterEach: function() { |
| 13 } | 13 } |
|
Jamie
2015/03/17 17:57:15
Can you just remove these empty functions?
kelvinp
2015/03/17 18:13:58
Done.
| |
| 14 }); | 14 }); |
| 15 | 15 |
| 16 QUnit.test('error constructor 1', function() { | 16 QUnit.test('error constructor 1', function() { |
| 17 var error = new remoting.Error(remoting.Error.Tag.HOST_OVERLOAD); | 17 var error = new remoting.Error(remoting.Error.Tag.HOST_OVERLOAD); |
| 18 QUnit.equal(error.getTag(), remoting.Error.Tag.HOST_OVERLOAD); | 18 QUnit.equal(error.getTag(), remoting.Error.Tag.HOST_OVERLOAD); |
| 19 QUnit.equal(error.toString(), remoting.Error.Tag.HOST_OVERLOAD); | 19 QUnit.equal(error.toString(), remoting.Error.Tag.HOST_OVERLOAD); |
| 20 }); | 20 }); |
| 21 | 21 |
| 22 QUnit.test('error constructor 2', function() { | 22 QUnit.test('error constructor 2', function() { |
| 23 var error = new remoting.Error( | 23 var error = new remoting.Error( |
| 24 remoting.Error.Tag.HOST_IS_OFFLINE, | 24 remoting.Error.Tag.HOST_IS_OFFLINE, |
| 25 'detail'); | 25 'detail'); |
| 26 QUnit.equal(error.getTag(), remoting.Error.Tag.HOST_IS_OFFLINE); | 26 QUnit.equal(error.getTag(), remoting.Error.Tag.HOST_IS_OFFLINE); |
| 27 QUnit.ok(error.toString().indexOf(remoting.Error.Tag.HOST_IS_OFFLINE) != -1); | 27 QUnit.ok(error.toString().indexOf(remoting.Error.Tag.HOST_IS_OFFLINE) != -1); |
| 28 QUnit.ok(error.toString().indexOf('detail') != -1); | 28 QUnit.ok(error.toString().indexOf('detail') != -1); |
| 29 }); | 29 }); |
| 30 | 30 |
| 31 QUnit.test('hasTag', function() { | 31 QUnit.test('hasTag', function() { |
| 32 var error = new remoting.Error(remoting.Error.Tag.HOST_OVERLOAD); | 32 var error = new remoting.Error(remoting.Error.Tag.HOST_OVERLOAD); |
| 33 QUnit.ok(error.hasTag(remoting.Error.Tag.HOST_OVERLOAD)); | 33 QUnit.ok(error.hasTag(remoting.Error.Tag.HOST_OVERLOAD)); |
| 34 QUnit.ok(error.hasTag( | 34 QUnit.ok(error.hasTag( |
| 35 remoting.Error.Tag.HOST_OVERLOAD, | 35 remoting.Error.Tag.HOST_OVERLOAD, |
| 36 remoting.Error.Tag.HOST_IS_OFFLINE)); | 36 remoting.Error.Tag.HOST_IS_OFFLINE)); |
| 37 QUnit.ok(!error.hasTag(remoting.Error.Tag.HOST_IS_OFFLINE)); | 37 QUnit.ok(!error.hasTag(remoting.Error.Tag.HOST_IS_OFFLINE)); |
|
Jamie
2015/03/17 17:57:16
Indentation.
kelvinp
2015/03/17 18:13:58
Done.
| |
| 38 }); | 38 }); |
| 39 | 39 |
| 40 QUnit.test('constructor methods', function() { | 40 QUnit.test('constructor methods', function() { |
| 41 QUnit.ok(remoting.Error.none().hasTag(remoting.Error.Tag.NONE)); | 41 QUnit.ok(remoting.Error.none().hasTag(remoting.Error.Tag.NONE)); |
| 42 QUnit.ok(remoting.Error.unexpected().hasTag(remoting.Error.Tag.UNEXPECTED)); | 42 QUnit.ok(remoting.Error.unexpected().hasTag(remoting.Error.Tag.UNEXPECTED)); |
| 43 }); | 43 }); |
| 44 | 44 |
| 45 QUnit.test('isNone', function() { | 45 QUnit.test('isNone', function() { |
| 46 QUnit.ok(remoting.Error.none().isNone()); | 46 QUnit.ok(remoting.Error.none().isNone()); |
| 47 QUnit.ok(!remoting.Error.unexpected().isNone()); | 47 QUnit.ok(!remoting.Error.unexpected().isNone()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 var reportedError; | 108 var reportedError; |
| 109 var onError = function(/** !remoting.Error */ arg) { | 109 var onError = function(/** !remoting.Error */ arg) { |
| 110 reportedError = arg; | 110 reportedError = arg; |
| 111 }; | 111 }; |
| 112 var origError = new remoting.Error(remoting.Error.Tag.HOST_IS_OFFLINE); | 112 var origError = new remoting.Error(remoting.Error.Tag.HOST_IS_OFFLINE); |
| 113 remoting.Error.handler(onError)(origError); | 113 remoting.Error.handler(onError)(origError); |
| 114 QUnit.equal(reportedError, origError); | 114 QUnit.equal(reportedError, origError); |
| 115 }); | 115 }); |
| 116 | 116 |
| 117 })(); | 117 })(); |
| OLD | NEW |