46 lines
1.8 KiB
JavaScript
46 lines
1.8 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getChromiumGpuInformation = void 0;
|
|
const get_browser_instance_1 = require("./get-browser-instance");
|
|
const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
|
|
const getChromiumGpuInformation = async ({ browserExecutable, indent, logLevel, chromiumOptions, timeoutInMilliseconds, onBrowserDownload, chromeMode, onLog, }) => {
|
|
const { page, cleanupPage: cleanup } = await (0, get_browser_instance_1.getPageAndCleanupFn)({
|
|
passedInInstance: undefined,
|
|
browserExecutable,
|
|
chromiumOptions,
|
|
forceDeviceScaleFactor: undefined,
|
|
indent,
|
|
logLevel,
|
|
onBrowserDownload,
|
|
chromeMode,
|
|
pageIndex: 0,
|
|
onBrowserLog: null,
|
|
onLog,
|
|
});
|
|
await page.goto({ url: 'chrome://gpu', timeout: 12000 });
|
|
const { value } = await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
|
|
pageFunction: () => {
|
|
var _a, _b, _c;
|
|
const statuses = [];
|
|
const items = (_c = (_b = (_a = document
|
|
.querySelector('info-view')) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('ul')) === null || _c === void 0 ? void 0 : _c.querySelectorAll('li');
|
|
[].forEach.call(items, (item) => {
|
|
// do whatever
|
|
const [feature, status] = item.innerText.split(': ');
|
|
statuses.push({
|
|
feature,
|
|
status,
|
|
});
|
|
});
|
|
return statuses;
|
|
},
|
|
frame: null,
|
|
args: [],
|
|
page,
|
|
timeoutInMilliseconds,
|
|
});
|
|
cleanup();
|
|
return value;
|
|
};
|
|
exports.getChromiumGpuInformation = getChromiumGpuInformation;
|