| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 a: 'a', | 68 a: 'a', |
| 69 foo: 'foo', | 69 foo: 'foo', |
| 70 escapist: ':/?#[]@$&+,;=' | 70 escapist: ':/?#[]@$&+,;=' |
| 71 }); | 71 }); |
| 72 QUnit.equal( | 72 QUnit.equal( |
| 73 result, | 73 result, |
| 74 'http://www.chromium.org?a=a&foo=foo' + | 74 'http://www.chromium.org?a=a&foo=foo' + |
| 75 '&escapist=%3A%2F%3F%23%5B%5D%40%24%26%2B%2C%3B%3D'); | 75 '&escapist=%3A%2F%3F%23%5B%5D%40%24%26%2B%2C%3B%3D'); |
| 76 }); | 76 }); |
| 77 | 77 |
| 78 test('escapeHTML(str) should escape special characters', function() { |
| 79 QUnit.equal( |
| 80 base.escapeHTML('<script>alert("hello")</script>'), |
| 81 '<script>alert("hello")</script>'); |
| 82 }); |
| 83 |
| 78 QUnit.asyncTest('Promise.sleep(delay) should fulfill the promise after |delay|', | 84 QUnit.asyncTest('Promise.sleep(delay) should fulfill the promise after |delay|', |
| 79 function() { | 85 function() { |
| 80 var isCalled = false; | 86 var isCalled = false; |
| 81 var clock = this.clock; | 87 var clock = this.clock; |
| 82 | 88 |
| 83 base.Promise.sleep(100).then(function(){ | 89 base.Promise.sleep(100).then(function(){ |
| 84 isCalled = true; | 90 isCalled = true; |
| 85 ok(true, 'Promise.sleep() is fulfilled after delay.'); | 91 ok(true, 'Promise.sleep() is fulfilled after delay.'); |
| 86 QUnit.start(); | 92 QUnit.start(); |
| 87 }); | 93 }); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 /* Ѓ */ 0xD0, 0x83, | 273 /* Ѓ */ 0xD0, 0x83, |
| 268 /* ф */ 0xD1, 0x84]).buffer), | 274 /* ф */ 0xD1, 0x84]).buffer), |
| 269 "挂Ѓф"); | 275 "挂Ѓф"); |
| 270 | 276 |
| 271 // Unicode surrogate pair for U+1F603. | 277 // Unicode surrogate pair for U+1F603. |
| 272 QUnit.equal(base.decodeUtf8(new Uint8Array([0xF0, 0x9F, 0x98, 0x83]).buffer), | 278 QUnit.equal(base.decodeUtf8(new Uint8Array([0xF0, 0x9F, 0x98, 0x83]).buffer), |
| 273 "😃"); | 279 "😃"); |
| 274 }); | 280 }); |
| 275 | 281 |
| 276 })(); | 282 })(); |
| OLD | NEW |