OLD | NEW |
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 Loading... |
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> |
OLD | NEW |