xref: /aosp_15_r20/external/skia/modules/canvaskit/tests/init_with_gold_server.js (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1// The increased timeout is especially needed with larger binaries
2// like in the debug/gpu build
3jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
4
5let CanvasKit = null;
6const _LoadCanvasKit = new Promise((resolve, reject) => {
7    console.log('canvaskit loading', new Date());
8    CanvasKitInit({
9        locateFile: (file) => '/static/skia/modules/canvaskit/canvaskit/'+file,
10    }).then((loaded) => {
11        console.log('canvaskit loaded', new Date());
12        CanvasKit = loaded;
13        resolve();
14    }).catch((e) => {
15        console.error('canvaskit failed to load', new Date(), e);
16        reject();
17    });
18});
19
20const _TestReportServer = new Promise((resolve, reject) => {
21    fetch('/gold_rpc/healthz').then((resp) => {
22        if (resp.ok) {
23            resolve();
24            return;
25        }
26        console.log('/healthz returned non 200 code')
27        reject();
28    }).catch((e) => {
29        console.log('Server for reporting results was not up', e)
30        reject();
31    });
32});
33
34const EverythingLoaded = Promise.all([_LoadCanvasKit, _TestReportServer]);
35