| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 /** | 5 /** |
| 6 * @param {!Array<string>} list | 6 * @param {!Array<string>} list |
| 7 * @return {string} | 7 * @return {string} |
| 8 */ | 8 */ |
| 9 function str(list) { | 9 function str(list) { |
| 10 return JSON.stringify(list); | 10 return JSON.stringify(list); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 var ActionService = downloads.ActionService; | 30 var ActionService = downloads.ActionService; |
| 31 assertEquals(str([]), str(ActionService.splitTerms(''))); | 31 assertEquals(str([]), str(ActionService.splitTerms(''))); |
| 32 assertEquals(str([]), str(ActionService.splitTerms(' '))); | 32 assertEquals(str([]), str(ActionService.splitTerms(' '))); |
| 33 assertEquals(str(['a']), str(ActionService.splitTerms('a'))); | 33 assertEquals(str(['a']), str(ActionService.splitTerms('a'))); |
| 34 assertEquals(str(['a b']), str(ActionService.splitTerms('a b'))); | 34 assertEquals(str(['a b']), str(ActionService.splitTerms('a b'))); |
| 35 assertEquals(str(['a', 'b']), str(ActionService.splitTerms('a "b"'))); | 35 assertEquals(str(['a', 'b']), str(ActionService.splitTerms('a "b"'))); |
| 36 assertEquals(str(['a', 'b', 'c']), str(ActionService.splitTerms('a "b" c'))); | 36 assertEquals(str(['a', 'b', 'c']), str(ActionService.splitTerms('a "b" c'))); |
| 37 assertEquals(str(['a', 'b b', 'c']), | 37 assertEquals(str(['a', 'b b', 'c']), |
| 38 str(ActionService.splitTerms('a "b b" c'))); | 38 str(ActionService.splitTerms('a "b b" c'))); |
| 39 }); | 39 }); |
| 40 |
| 41 TEST_F('ActionServiceUnitTest', 'searchWithSimilarTerms', function() { |
| 42 /** |
| 43 * @extends {downloads.ActionService} |
| 44 * @constructor |
| 45 */ |
| 46 function TestActionService() { |
| 47 downloads.ActionService.call(this); |
| 48 } |
| 49 |
| 50 TestActionService.prototype = { |
| 51 __proto__: downloads.ActionService.prototype, |
| 52 loadMore: function() { /* No chrome.send() for you! */ }, |
| 53 }; |
| 54 |
| 55 var actionService = new TestActionService(); |
| 56 |
| 57 assertTrue(actionService.search('a')); |
| 58 assertFalse(actionService.search('a ')); // Same term + space should no-op. |
| 59 }); |
| OLD | NEW |