From 1146b2d5c1d0e1f74e8b383725e530713f506ac8 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 8 Jun 2016 14:44:30 +0900 Subject: [PATCH] spec: Custom protocol can have "fetch" working in it --- spec/api-protocol-spec.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/api-protocol-spec.js b/spec/api-protocol-spec.js index 803511917104..57e8638ee6d3 100644 --- a/spec/api-protocol-spec.js +++ b/spec/api-protocol-spec.js @@ -919,6 +919,23 @@ describe('protocol module', function () { }) w.loadURL(origin) }) + }), + + it('can have fetch working in it', function (done) { + const content = '' + const handler = function (request, callback) { + callback({data: content, mimeType: 'text/html'}) + } + protocol.registerStringProtocol(standardScheme, handler, function (error) { + if (error) return done(error) + w.webContents.on('crashed', function () { + done('WebContents crashed') + }) + w.webContents.on('did-finish-load', function () { + done() + }) + w.loadURL(origin) + }) }) }) })