Chromium Code Reviews| Index: chrome/browser/resources/md_downloads/action_service_unittest.gtestjs |
| diff --git a/chrome/browser/resources/md_downloads/action_service_unittest.gtestjs b/chrome/browser/resources/md_downloads/action_service_unittest.gtestjs |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b188594012cef17a710b54fc57f099697c0d81ae |
| --- /dev/null |
| +++ b/chrome/browser/resources/md_downloads/action_service_unittest.gtestjs |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @param {!Array<string>} list |
| + * @return {string} |
| + */ |
| +function str(list) { |
| + return JSON.stringify(list); |
| +} |
| + |
| +/** |
| + * @extends {testing.Test} |
| + * @constructor |
| + */ |
| +function ActionServiceUnitTest() {} |
| + |
| +ActionServiceUnitTest.prototype = { |
| + __proto__: testing.Test.prototype, |
| + |
| + /** @override */ |
| + extraLibraries: [ |
| + '../../../../ui/webui/resources/js/cr.js', |
| + 'action_service.js', |
| + ], |
| +}; |
| + |
| +TEST_F('ActionServiceUnitTest', 'splitTerms', function() { |
| + var ActionService = downloads.ActionService; |
|
dpapad
2015/12/03 01:19:41
Nit (optional): You can reduce repetition as follo
Dan Beam
2015/12/11 08:17:22
meh, more lines, more indirection
|
| + assertEquals(str([]), str(ActionService.splitTerms(''))); |
| + assertEquals(str([]), str(ActionService.splitTerms(' '))); |
| + assertEquals(str(['a']), str(ActionService.splitTerms('a'))); |
| + assertEquals(str(['a b']), str(ActionService.splitTerms('a b'))); |
| + assertEquals(str(['a', 'b']), str(ActionService.splitTerms('a "b"'))); |
| + assertEquals(str(['a', 'b', 'c']), str(ActionService.splitTerms('a "b" c'))); |
| +}); |