Skip to content

Commit

Permalink
[canvaskit] Remove additional copies of CanvasKit when testing
Browse files Browse the repository at this point in the history
Speculative fix for flaky test bot. My guess is that since there were
3 .spec.js that were all trying to load CanvasKit at the same time, the
browser would fail to compile/process all that WASM and timeout.

This cleans it up so there's only one copy of CanvasKit shared by all
tests.

Bug: skia:8810
Change-Id: I60a77dae93b7c3e5d45923b4af93a223ac26220c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/198161
Auto-Submit: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ben Wagner <benjaminwagner@google.com>
Commit-Queue: Ben Wagner <benjaminwagner@google.com>
  • Loading branch information
kjlubick authored and Skia Commit-Bot committed Mar 6, 2019
1 parent 2a889a8 commit cb4eb61
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 74 deletions.
1 change: 1 addition & 0 deletions experimental/canvaskit/karma.bench.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function(config) {
{ pattern: 'perf/assets/*', included:false, served:true},
'../../modules/pathkit/perf/perfReporter.js',
'canvaskit/bin/canvaskit.js',
'tests/canvaskitinit.js',
'perf/*.bench.js'
],

Expand Down
1 change: 1 addition & 0 deletions experimental/canvaskit/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = function(config) {
{ pattern: 'tests/assets/*', included:false, served:true},
'../../modules/pathkit/tests/testReporter.js',
'canvaskit/bin/canvaskit.js',
'tests/canvaskitinit.js',
'tests/util.js',
'tests/*.spec.js'
],
Expand Down
18 changes: 0 additions & 18 deletions experimental/canvaskit/perf/animation.bench.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
// The increased timeout is especially needed with larger binaries
// like in the debug/gpu build
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

describe('CanvasKit\'s Animation', function() {
// Note, don't try to print the CanvasKit object - it can cause Karma/Jasmine to lock up.
var CanvasKit = null;
const LoadCanvasKit = new Promise(function(resolve, reject) {
if (CanvasKit) {
resolve();
} else {
CanvasKitInit({
locateFile: (file) => '/canvaskit/'+file,
}).ready().then((_CanvasKit) => {
CanvasKit = _CanvasKit;
resolve();
});
}
});

const LOTTIE_ANIMATIONS = ['lego_loader', 'drinks', 'confetti', 'onboarding'];

Expand Down
18 changes: 0 additions & 18 deletions experimental/canvaskit/tests/canvas2d.spec.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
// The increased timeout is especially needed with larger binaries
// like in the debug/gpu build
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

describe('CanvasKit\'s Canvas 2d Behavior', function() {
// Note, don't try to print the CanvasKit object - it can cause Karma/Jasmine to lock up.
var CanvasKit = null;
const LoadCanvasKit = new Promise(function(resolve, reject) {
if (CanvasKit) {
resolve();
} else {
CanvasKitInit({
locateFile: (file) => '/canvaskit/'+file,
}).ready().then((_CanvasKit) => {
CanvasKit = _CanvasKit;
resolve();
});
}
});

let container = document.createElement('div');
document.body.appendChild(container);
Expand Down
13 changes: 13 additions & 0 deletions experimental/canvaskit/tests/canvaskitinit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// The increased timeout is especially needed with larger binaries
// like in the debug/gpu build
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

let CanvasKit = null;
const LoadCanvasKit = new Promise(function(resolve, reject) {
CanvasKitInit({
locateFile: (file) => '/canvaskit/'+file,
}).ready().then((loaded) => {
CanvasKit = loaded;
resolve();
});
});
19 changes: 0 additions & 19 deletions experimental/canvaskit/tests/font.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
// The increased timeout is especially needed with larger binaries
// like in the debug/gpu build
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

describe('CanvasKit\'s Path Behavior', function() {
// Note, don't try to print the CanvasKit object - it can cause Karma/Jasmine to lock up.
var CanvasKit = null;
const LoadCanvasKit = new Promise(function(resolve, reject) {
if (CanvasKit) {
resolve();
} else {
CanvasKitInit({
locateFile: (file) => '/canvaskit/'+file,
}).ready().then((_CanvasKit) => {
CanvasKit = _CanvasKit;
resolve();
});
}
});

let container = document.createElement('div');
document.body.appendChild(container);
const CANVAS_WIDTH = 600;
Expand Down
19 changes: 0 additions & 19 deletions experimental/canvaskit/tests/path.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,4 @@
// The increased timeout is especially needed with larger binaries
// like in the debug/gpu build
jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

describe('CanvasKit\'s Path Behavior', function() {
// Note, don't try to print the CanvasKit object - it can cause Karma/Jasmine to lock up.
var CanvasKit = null;
const LoadCanvasKit = new Promise(function(resolve, reject) {
if (CanvasKit) {
resolve();
} else {
CanvasKitInit({
locateFile: (file) => '/canvaskit/'+file,
}).ready().then((_CanvasKit) => {
CanvasKit = _CanvasKit;
resolve();
});
}
});

let container = document.createElement('div');
document.body.appendChild(container);
const CANVAS_WIDTH = 600;
Expand Down

0 comments on commit cb4eb61

Please sign in to comment.