OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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. |
| 4 |
| 5 /** |
| 6 * @param {!Array<string>} list |
| 7 * @return {string} |
| 8 */ |
| 9 function str(list) { |
| 10 return JSON.stringify(list); |
| 11 } |
| 12 |
| 13 /** |
| 14 * @extends {testing.Test} |
| 15 * @constructor |
| 16 */ |
| 17 function ActionServiceUnitTest() {} |
| 18 |
| 19 ActionServiceUnitTest.prototype = { |
| 20 __proto__: testing.Test.prototype, |
| 21 |
| 22 /** @override */ |
| 23 extraLibraries: [ |
| 24 '../../../../ui/webui/resources/js/cr.js', |
| 25 'action_service.js', |
| 26 ], |
| 27 }; |
| 28 |
| 29 TEST_F('ActionServiceUnitTest', 'splitTerms', function() { |
| 30 var ActionService = downloads.ActionService; |
| 31 assertEquals(str([]), str(ActionService.splitTerms(''))); |
| 32 assertEquals(str(['a']), str(ActionService.splitTerms('a'))); |
| 33 assertEquals(str(['a b']), str(ActionService.splitTerms('a b'))); |
| 34 assertEquals(str(['a', 'b']), str(ActionService.splitTerms('a "b"'))); |
| 35 assertEquals(str(['a', 'b', 'c']), str(ActionService.splitTerms('a "b" c'))); |
| 36 }); |
OLD | NEW |