1fc0c1c0f8
This CL makes a copy of all the files in //modules/canvaskit/tests/ and puts them into //modules/canvaskit/tests/bazel. They are slightly modified to run in Bazel (renamed to be more clear what they are and using EverythingLoaded instead of CanvasKitLoaded). The original files will be deleted when we no longer test CanvasKit outside of Bazel. Suggested Review Order: - hello_world.js is now smoke_test.js. That test polls the gold_test_env server, but does not create an image. - test_reporter.js which is much simplified from the non-Bazel version (due to the removal of a bunch of PathKit stuff). These JS tests are not the C++ gms. This means that we need to capture the PNG ourselves, which we do using the <canvas> API toDataURL(). This is base64 encoded, which is conveniently the format accepted by the gold_test_env server. - karma.bazel.js and assets/BUILD.bazel which make all the test assets available under a shortened path /assets. - Feel free to skip over the remaining *_test.js, as they are basically the same as what is currently checked in, just with the modifications above. - Any remaining files. Change-Id: I45fc38da38faf11f21011e7381d390e6bb299df4 Bug: skia:12541 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/513916 Reviewed-by: Leandro Lovisolo <lovisolo@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
const path = require('path');
|
|
const fs = require('fs')
|
|
// This should be a file created by gold_test_env.go which contains the port number
|
|
// on which it is listening. For whatever reason, karma was not happy serving the
|
|
// port file directly, but reading it in and then adding it as a proxy seems to
|
|
// work fine.
|
|
const testOnEnvPortPath = path.join(process.env['ENV_DIR'], 'port');
|
|
const port = fs.readFileSync(testOnEnvPortPath, 'utf8').toString();
|
|
console.log('test_on_env PORT:', port);
|
|
|
|
module.exports = function(config) {
|
|
// http://karma-runner.github.io/6.3/config/configuration-file.html
|
|
let cfg = {
|
|
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
|
frameworks: ['jasmine'],
|
|
|
|
proxies: {
|
|
// The tests will make calls to /gold_rpc/whatever and they will be redirected
|
|
// to the correct location.
|
|
'/gold_rpc/': `http://localhost:${port}/`,
|
|
// This makes it more convenient for tests to load the test assets.
|
|
'/assets/': '/static/skia/modules/canvaskit/tests/assets/',
|
|
},
|
|
|
|
// possible values: 'dots', 'progress'
|
|
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
|
reporters: ['progress'],
|
|
colors: true,
|
|
logLevel: config.LOG_INFO,
|
|
|
|
browserDisconnectTimeout: 20000,
|
|
browserNoActivityTimeout: 20000,
|
|
|
|
// How many browsers should be started simultaneous
|
|
concurrency: Infinity,
|
|
};
|
|
|
|
// Bazel will inject some code here to add/change the following items:
|
|
// - files
|
|
// - proxies
|
|
// - browsers
|
|
// - basePath
|
|
// - singleRun
|
|
BAZEL_APPLY_SETTINGS(cfg);
|
|
|
|
config.set(cfg);
|
|
};
|