spec: unskip webview.printToPDF (#22122)

This commit is contained in:
Shelley Vohr 2020-02-11 03:35:05 +00:00 committed by GitHub
parent 2bfe66bcfd
commit 80dd16aa78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View file

@ -99,8 +99,6 @@ class SystemPreferences : public gin_helper::EventEmitter<SystemPreferences>
static bool IsTrustedAccessibilityClient(bool prompt);
// TODO(codebytere): Write tests for these methods once we
// are running tests on a Mojave machine
std::string GetMediaAccessStatus(const std::string& media_type,
gin_helper::Arguments* args);
v8::Local<v8::Promise> AskForMediaAccess(v8::Isolate* isolate,

View file

@ -1010,14 +1010,35 @@ describe('<webview> tag', function () {
})
describe('<webview>.printToPDF()', () => {
before(function () {
before(() => {
if (!features.isPrintingEnabled()) {
this.skip()
}
})
// TODO(deepak1556): Fix and enable after upgrade.
it.skip('can print to PDF', async () => {
it('rejects on incorrectly typed parameters', async () => {
const badTypes = {
marginsType: 'terrible',
scaleFactor: 'not-a-number',
landscape: [],
pageRanges: { 'oops': 'im-not-the-right-key' },
headerFooter: '123',
printSelectionOnly: 1,
printBackground: 2,
pageSize: 'IAmAPageSize'
}
// These will hard crash in Chromium unless we type-check
for (const [key, value] of Object.entries(badTypes)) {
const param = { [key]: value }
const src = 'data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E'
await loadWebView(webview, { src })
await expect(webview.printToPDF(param)).to.eventually.be.rejected()
}
})
it('can print to PDF', async () => {
const src = 'data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E'
await loadWebView(webview, { src })