Skip to content

Commit 5ce947a

Browse files
committed
Fix tests after r213119 and r213120.
* browser-tests/time-series-chart-tests.js: (return.ChartTest.importChartScripts.context.then): (string_appeared_here.then): Deleted. Canonical link: https://commits.webkit.org/185953@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213122 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 1f175d6 commit 5ce947a

2 files changed

Lines changed: 56 additions & 32 deletions

File tree

Websites/perf.webkit.org/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2017-02-27 Ryosuke Niwa <rniwa@webkit.org>
2+
3+
Fix tests after r213119 and r213120.
4+
5+
* browser-tests/time-series-chart-tests.js:
6+
(return.ChartTest.importChartScripts.context.then):
7+
(string_appeared_here.then): Deleted.
8+
19
2017-02-27 Ryosuke Niwa <rniwa@webkit.org>
210

311
Removed the unused code that was supposed to be removed in the previous commit.

Websites/perf.webkit.org/browser-tests/time-series-chart-tests.js

Lines changed: 48 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -282,134 +282,149 @@ describe('TimeSeriesChart', () => {
282282
}
283283

284284
it('should generate [0.5, 1.0, 1.5, 2.0] for [0.3, 2.3] when maxLabels is 5', () => {
285-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
286-
const [TimeSeriesChart, Metric] = symbols;
285+
const context = new BrowsingContext;
286+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
287+
const Metric = context.symbols.Metric;
287288
const grid = TimeSeriesChart.computeValueGrid(0.3, 2.3, 5, Metric.makeFormatter('pt', 2));
288289
expect(grid.map((item) => approximate(item.value))).to.eql([0.5, 1.0, 1.5, 2.0]);
289290
expect(grid.map((item) => item.label)).to.eql(['0.5 pt', '1.0 pt', '1.5 pt', '2.0 pt']);
290291
});
291292
});
292293

293294
it('should generate [0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2] for [0.3, 2.3] when maxLabels is 10', () => {
294-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
295-
const [TimeSeriesChart, Metric] = symbols;
295+
const context = new BrowsingContext;
296+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
297+
const Metric = context.symbols.Metric;
296298
const grid = TimeSeriesChart.computeValueGrid(0.3, 2.3, 10, Metric.makeFormatter('pt', 2));
297299
expect(grid.map((item) => approximate(item.value))).to.eql([0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2]);
298300
expect(grid.map((item) => item.label)).to.eql(['0.4 pt', '0.6 pt', '0.8 pt', '1.0 pt', '1.2 pt', '1.4 pt', '1.6 pt', '1.8 pt', '2.0 pt', '2.2 pt']);
299301
});
300302
});
301303

302304
it('should generate [1, 2] for [0.3, 2.3] when maxLabels is 2', () => {
303-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
304-
const [TimeSeriesChart, Metric] = symbols;
305+
const context = new BrowsingContext;
306+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
307+
const Metric = context.symbols.Metric;
305308
const grid = TimeSeriesChart.computeValueGrid(0.3, 2.3, 2, Metric.makeFormatter('pt', 2));
306309
expect(grid.map((item) => item.value)).to.eql([1, 2]);
307310
expect(grid.map((item) => item.label)).to.eql(['1.0 pt', '2.0 pt']);
308311
});
309312
});
310313

311314
it('should generate [0.4, 0.6, 0.8, 1.0, 1.2] for [0.3, 1.3] when maxLabels is 5', () => {
312-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
313-
const [TimeSeriesChart, Metric] = symbols;
315+
const context = new BrowsingContext;
316+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
317+
const Metric = context.symbols.Metric;
314318
const grid = TimeSeriesChart.computeValueGrid(0.3, 1.3, 5, Metric.makeFormatter('pt', 2));
315319
expect(grid.map((item) => approximate(item.value))).to.eql([0.4, 0.6, 0.8, 1.0, 1.2]);
316320
expect(grid.map((item) => item.label)).to.eql(['0.4 pt', '0.6 pt', '0.8 pt', '1.0 pt', '1.2 pt']);
317321
});
318322
});
319323

320324
it('should generate [0.2, 0.4, 0.6, 0.8, 1, 1.2] for [0.2, 1.3] when maxLabels is 10', () => {
321-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
322-
const [TimeSeriesChart, Metric] = symbols;
325+
const context = new BrowsingContext;
326+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
327+
const Metric = context.symbols.Metric;
323328
const grid = TimeSeriesChart.computeValueGrid(0.2, 1.3, 10, Metric.makeFormatter('pt', 2));
324329
expect(grid.map((item) => approximate(item.value))).to.eql([0.2, 0.4, 0.6, 0.8, 1, 1.2]);
325330
expect(grid.map((item) => item.label)).to.eql(['0.2 pt', '0.4 pt', '0.6 pt', '0.8 pt', '1.0 pt', '1.2 pt']);
326331
});
327332
});
328333

329334
it('should generate [0.5, 1.0] for [0.3, 1.3] when maxLabels is 4', () => {
330-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
331-
const [TimeSeriesChart, Metric] = symbols;
335+
const context = new BrowsingContext;
336+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
337+
const Metric = context.symbols.Metric;
332338
const grid = TimeSeriesChart.computeValueGrid(0.3, 1.3, 4, Metric.makeFormatter('pt', 2));
333339
expect(grid.map((item) => approximate(item.value))).to.eql([0.5, 1.0]);
334340
expect(grid.map((item) => item.label)).to.eql(['0.5 pt', '1.0 pt']);
335341
});
336342
});
337343

338344
it('should generate [10, 20, 30] for [4, 35] when maxLabels is 4', () => {
339-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
340-
const [TimeSeriesChart, Metric] = symbols;
345+
const context = new BrowsingContext;
346+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
347+
const Metric = context.symbols.Metric;
341348
const grid = TimeSeriesChart.computeValueGrid(4, 35, 4, Metric.makeFormatter('pt', 2));
342349
expect(grid.map((item) => item.value)).to.eql([10, 20, 30]);
343350
expect(grid.map((item) => item.label)).to.eql(['10 pt', '20 pt', '30 pt']);
344351
});
345352
});
346353

347354
it('should generate [10, 20, 30] for [4, 35] when maxLabels is 6', () => {
348-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
349-
const [TimeSeriesChart, Metric] = symbols;
355+
const context = new BrowsingContext;
356+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
357+
const Metric = context.symbols.Metric;
350358
const grid = TimeSeriesChart.computeValueGrid(4, 35, 6, Metric.makeFormatter('pt', 2));
351359
expect(grid.map((item) => item.value)).to.eql([10, 20, 30]);
352360
expect(grid.map((item) => item.label)).to.eql(['10 pt', '20 pt', '30 pt']);
353361
});
354362
});
355363

356364
it('should generate [10, 15, 20, 25, 30, 35] for [6, 35] when maxLabels is 6', () => {
357-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
358-
const [TimeSeriesChart, Metric] = symbols;
365+
const context = new BrowsingContext;
366+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
367+
const Metric = context.symbols.Metric;
359368
const grid = TimeSeriesChart.computeValueGrid(6, 35, 6, Metric.makeFormatter('pt', 2));
360369
expect(grid.map((item) => item.value)).to.eql([10, 15, 20, 25, 30, 35]);
361370
expect(grid.map((item) => item.label)).to.eql(['10 pt', '15 pt', '20 pt', '25 pt', '30 pt', '35 pt']);
362371
});
363372
});
364373

365374
it('should generate [110, 115, 120, 125, 130] for [107, 134] when maxLabels is 6', () => {
366-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
367-
const [TimeSeriesChart, Metric] = symbols;
375+
const context = new BrowsingContext;
376+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
377+
const Metric = context.symbols.Metric;
368378
const grid = TimeSeriesChart.computeValueGrid(107, 134, 6, Metric.makeFormatter('pt', 3));
369379
expect(grid.map((item) => item.value)).to.eql([110, 115, 120, 125, 130]);
370380
expect(grid.map((item) => item.label)).to.eql(['110 pt', '115 pt', '120 pt', '125 pt', '130 pt']);
371381
});
372382
});
373383

374384
it('should generate [5e7, 10e7] for [1e7, 1e8] when maxLabels is 4', () => {
375-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
376-
const [TimeSeriesChart, Metric] = symbols;
385+
const context = new BrowsingContext;
386+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
387+
const Metric = context.symbols.Metric;
377388
const grid = TimeSeriesChart.computeValueGrid(1e7, 1e8, 4, Metric.makeFormatter('pt', 3));
378389
expect(grid.map((item) => item.value)).to.eql([5e7, 10e7]);
379390
expect(grid.map((item) => item.label)).to.eql(['50.0 Mpt', '100 Mpt']);
380391
});
381392
});
382393

383394
it('should generate [2e7, 4e7, 6e7, 8e7, 10e7] for [1e7, 1e8] when maxLabels is 5', () => {
384-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
385-
const [TimeSeriesChart, Metric] = symbols;
395+
const context = new BrowsingContext;
396+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
397+
const Metric = context.symbols.Metric;
386398
const grid = TimeSeriesChart.computeValueGrid(1e7, 1e8, 5, Metric.makeFormatter('pt', 3));
387399
expect(grid.map((item) => item.value)).to.eql([2e7, 4e7, 6e7, 8e7, 10e7]);
388400
expect(grid.map((item) => item.label)).to.eql(['20.0 Mpt', '40.0 Mpt', '60.0 Mpt', '80.0 Mpt', '100 Mpt']);
389401
});
390402
});
391403

392404
it('should generate [-1.5, -1.0, -0.5, 0.0, 0.5] for [-1.8, 0.7] when maxLabels is 5', () => {
393-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
394-
const [TimeSeriesChart, Metric] = symbols;
405+
const context = new BrowsingContext;
406+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
407+
const Metric = context.symbols.Metric;
395408
const grid = TimeSeriesChart.computeValueGrid(-1.8, 0.7, 5, Metric.makeFormatter('pt', 2));
396409
expect(grid.map((item) => approximate(item.value))).to.eql([-1.5, -1.0, -0.5, 0.0, 0.5]);
397410
expect(grid.map((item) => item.label)).to.eql(['-1.5 pt', '-1.0 pt', '-0.5 pt', '0.0 pt', '0.5 pt']);
398411
});
399412
});
400413

401414
it('should generate [200ms, 400ms, 600ms, 800ms, 1.00s, 1.20s] for [0.2, 1.3] when maxLabels is 10 and unit is seconds', () => {
402-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
403-
const [TimeSeriesChart, Metric] = symbols;
415+
const context = new BrowsingContext;
416+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
417+
const Metric = context.symbols.Metric;
404418
const grid = TimeSeriesChart.computeValueGrid(0.2, 1.3, 10, Metric.makeFormatter('s', 3));
405419
expect(grid.map((item) => approximate(item.value))).to.eql([0.2, 0.4, 0.6, 0.8, 1, 1.2]);
406420
expect(grid.map((item) => item.label)).to.eql(['200 ms', '400 ms', '600 ms', '800 ms', '1.00 s', '1.20 s']);
407421
});
408422
});
409423

410424
it('should generate [2.0GB, 4.0GB, 6.0GB] for [1.2GB, 7.2GB] when maxLabels is 4 and unit is bytes', () => {
411-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
412-
const [TimeSeriesChart, Metric] = symbols;
425+
const context = new BrowsingContext;
426+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
427+
const Metric = context.symbols.Metric;
413428
const gigabytes = Math.pow(1024, 3);
414429
const grid = TimeSeriesChart.computeValueGrid(1.2 * gigabytes, 7.2 * gigabytes, 4, Metric.makeFormatter('B', 2));
415430
expect(grid.map((item) => approximate(item.value))).to.eql([2 * gigabytes, 4 * gigabytes, 6 * gigabytes]);
@@ -418,8 +433,9 @@ describe('TimeSeriesChart', () => {
418433
});
419434

420435
it('should generate [0.6GB, 0.8GB, 1.0GB, 1.2GB] for [0.53GB, 1.23GB] when maxLabels is 4 and unit is bytes', () => {
421-
return new BrowsingContext().importScripts(scripts, 'TimeSeriesChart', 'Metric').then((symbols) => {
422-
const [TimeSeriesChart, Metric] = symbols;
436+
const context = new BrowsingContext;
437+
return ChartTest.importChartScripts(context).then((TimeSeriesChart) => {
438+
const Metric = context.symbols.Metric;
423439
const gigabytes = Math.pow(1024, 3);
424440
const grid = TimeSeriesChart.computeValueGrid(0.53 * gigabytes, 1.23 * gigabytes, 4, Metric.makeFormatter('B', 2));
425441
expect(grid.map((item) => item.label)).to.eql(['0.6 GB', '0.8 GB', '1.0 GB', '1.2 GB']);

0 commit comments

Comments
 (0)