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 module('base'); | 9 module('base'); |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 base.dispose(obj); | 49 base.dispose(obj); |
50 sinon.assert.called(obj.dispose); | 50 sinon.assert.called(obj.dispose); |
51 }); | 51 }); |
52 | 52 |
53 test('dispose(obj) should not crash if |obj| is null', | 53 test('dispose(obj) should not crash if |obj| is null', |
54 function() { | 54 function() { |
55 expect(0); | 55 expect(0); |
56 base.dispose(null); | 56 base.dispose(null); |
57 }); | 57 }); |
58 | 58 |
| 59 test('urljoin(url, opt_param) should return url if |opt_param| is missing', |
| 60 function() { |
| 61 QUnit.equal( |
| 62 base.urlJoin('http://www.chromium.org'), 'http://www.chromium.org'); |
| 63 }); |
| 64 |
| 65 test('urljoin(url, opt_param) should urlencode |opt_param|', |
| 66 function() { |
| 67 var result = base.urlJoin('http://www.chromium.org', { |
| 68 a: 'a', |
| 69 foo: 'foo', |
| 70 escapist: ':/?#[]@$&+,;=' |
| 71 }); |
| 72 QUnit.equal( |
| 73 result, |
| 74 'http://www.chromium.org?a=a&foo=foo' + |
| 75 '&escapist=%3A%2F%3F%23%5B%5D%40%24%26%2B%2C%3B%3D'); |
| 76 }); |
| 77 |
59 QUnit.asyncTest('Promise.sleep(delay) should fulfill the promise after |delay|', | 78 QUnit.asyncTest('Promise.sleep(delay) should fulfill the promise after |delay|', |
60 function() { | 79 function() { |
61 var isCalled = false; | 80 var isCalled = false; |
62 var clock = this.clock; | 81 var clock = this.clock; |
63 | 82 |
64 base.Promise.sleep(100).then(function(){ | 83 base.Promise.sleep(100).then(function(){ |
65 isCalled = true; | 84 isCalled = true; |
66 ok(true, 'Promise.sleep() is fulfilled after delay.'); | 85 ok(true, 'Promise.sleep() is fulfilled after delay.'); |
67 QUnit.start(); | 86 QUnit.start(); |
68 }); | 87 }); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 194 |
176 source.addEventListener('foo', sink.listener); | 195 source.addEventListener('foo', sink.listener); |
177 source.raiseEvent('foo'); | 196 source.raiseEvent('foo'); |
178 sinon.assert.calledOnce(sink.listener); | 197 sinon.assert.calledOnce(sink.listener); |
179 | 198 |
180 source.raiseEvent('foo'); | 199 source.raiseEvent('foo'); |
181 sinon.assert.calledOnce(sink.listener); | 200 sinon.assert.calledOnce(sink.listener); |
182 }); | 201 }); |
183 | 202 |
184 })(); | 203 })(); |
OLD | NEW |