spec: unskip webview.printToPDF (#22122)
This commit is contained in:
parent
2bfe66bcfd
commit
80dd16aa78
2 changed files with 24 additions and 5 deletions
|
@ -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,
|
||||
|
|
|
@ -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 })
|
||||
|
||||
|
|
Loading…
Reference in a new issue