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

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

Issue 2959713003: Remove tr.b.findFirstKeyInDictMatching. (Closed)
Patch Set: rebase 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
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 const dict = tr.b.arrayToDict(array, function(value) { 233 const dict = tr.b.arrayToDict(array, function(value) {
234 return this.prefix + value; 234 return this.prefix + value;
235 }, fakeThis); 235 }, fakeThis);
236 assert.deepEqual(dict, { 236 assert.deepEqual(dict, {
237 'key_5': 5, 237 'key_5': 5,
238 'key_undefined': undefined, 238 'key_undefined': undefined,
239 'key_test': 'test' 239 'key_test': 'test'
240 }); 240 });
241 }); 241 });
242 242
243 test('findFirstKeyInDictMatching', function() {
244 const dict = {a: 1, b: 2, c: 3};
245
246 let k = tr.b.findFirstKeyInDictMatching(dict, function(key, value) {
247 return value === 2;
248 }, this);
249 assert.strictEqual(k, 'b');
250
251 k = tr.b.findFirstKeyInDictMatching(dict, function(key, value) {
252 return false;
253 }, this);
254 assert.strictEqual(k, undefined);
255 });
256
257 test('mapValues', function() { 243 test('mapValues', function() {
258 const map = new Map(); 244 const map = new Map();
259 map.set('a', 1); 245 map.set('a', 1);
260 map.set('b', 2); 246 map.set('b', 2);
261 map.set('c', 3); 247 map.set('c', 3);
262 const values = tr.b.mapValues(map); 248 const values = tr.b.mapValues(map);
263 assert.strictEqual(values.length, 3); 249 assert.strictEqual(values.length, 3);
264 assert.sameMembers([1, 2, 3], values); 250 assert.sameMembers([1, 2, 3], values);
265 }); 251 });
266 }); 252 });
267 </script> 253 </script>
OLDNEW
« no previous file with comments | « tracing/tracing/base/iteration_helpers.html ('k') | tracing/tracing/base/multi_dimensional_view_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698