[canvaskit] Remove additional copies of CanvasKit when testing

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>
This commit is contained in:
Kevin Lubick 2019-03-06 09:30:44 -05:00 committed by Skia Commit-Bot
parent 2a889a84a2
commit cb4eb612f0
7 changed files with 15 additions and 74 deletions

View File

@ -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'
],

View File

@ -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'
],

View File

@ -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'];

View File

@ -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);

View File

@ -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();
});
});

View File

@ -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;

View File

@ -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;