Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: chrome/browser/resources/md_downloads/action_service_unittest.gtestjs

Issue 2289013002: Merge: MD Downloads: fix search spinner when terms are the same (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_downloads/action_service.js ('k') | chrome/browser/resources/md_downloads/crisper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698