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

Side by Side Diff: tracing/tracing/base/iteration_helpers_test.html

Issue 2956023002: Remove tr.b.dictionaryContainsValue. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « tracing/tracing/base/iteration_helpers.html ('k') | tracing/tracing/ui/base/table.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2014 The Chromium Authors. All rights reserved. 3 Copyright (c) 2014 The Chromium Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style license that can be 4 Use of this source code is governed by a BSD-style license that can be
5 found in the LICENSE file. 5 found in the LICENSE file.
6 --> 6 -->
7 <link rel="import" href="/tracing/base/iteration_helpers.html"> 7 <link rel="import" href="/tracing/base/iteration_helpers.html">
8 <script> 8 <script>
9 'use strict'; 9 'use strict';
10 10
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return value === 2; 277 return value === 2;
278 }, this); 278 }, this);
279 assert.strictEqual(k, 'b'); 279 assert.strictEqual(k, 'b');
280 280
281 k = tr.b.findFirstKeyInDictMatching(dict, function(key, value) { 281 k = tr.b.findFirstKeyInDictMatching(dict, function(key, value) {
282 return false; 282 return false;
283 }, this); 283 }, this);
284 assert.strictEqual(k, undefined); 284 assert.strictEqual(k, undefined);
285 }); 285 });
286 286
287 test('dictionaryContainsValue', function() {
288 const emptyDict = {};
289 assert.isFalse(tr.b.dictionaryContainsValue(emptyDict, 'missing'));
290
291 const nonEmptyDict = {a: 42, b: 'value'};
292 assert.isTrue(tr.b.dictionaryContainsValue(nonEmptyDict, 42));
293 assert.isTrue(tr.b.dictionaryContainsValue(nonEmptyDict, 'value'));
294 assert.isFalse(tr.b.dictionaryContainsValue(nonEmptyDict, 'a'));
295 assert.isFalse(tr.b.dictionaryContainsValue(nonEmptyDict, 'b'));
296 assert.isFalse(tr.b.dictionaryContainsValue(nonEmptyDict, 'missing'));
297 });
298
299 test('mapValues', function() { 287 test('mapValues', function() {
300 const map = new Map(); 288 const map = new Map();
301 map.set('a', 1); 289 map.set('a', 1);
302 map.set('b', 2); 290 map.set('b', 2);
303 map.set('c', 3); 291 map.set('c', 3);
304 const values = tr.b.mapValues(map); 292 const values = tr.b.mapValues(map);
305 assert.strictEqual(values.length, 3); 293 assert.strictEqual(values.length, 3);
306 assert.sameMembers([1, 2, 3], values); 294 assert.sameMembers([1, 2, 3], values);
307 }); 295 });
308 }); 296 });
309 </script> 297 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/iteration_helpers.html ('k') | tracing/tracing/ui/base/table.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698