2016-02-16 23:09:35 +00:00
|
|
|
const assert = require('assert');
|
|
|
|
const deprecations = require('electron').deprecations;
|
|
|
|
|
|
|
|
describe('deprecations', function() {
|
|
|
|
beforeEach(function() {
|
|
|
|
deprecations.setHandler(null);
|
|
|
|
process.throwDeprecation = true;
|
|
|
|
});
|
|
|
|
|
|
|
|
it('allows a deprecation handler function to be specified', function() {
|
|
|
|
var messages = [];
|
|
|
|
|
|
|
|
deprecations.setHandler(function (message) {
|
2016-02-16 23:26:58 +00:00
|
|
|
messages.push(message);
|
2016-02-16 23:09:35 +00:00
|
|
|
});
|
|
|
|
|
2016-02-16 23:26:58 +00:00
|
|
|
require('electron').webFrame.registerUrlSchemeAsSecure('some-scheme');
|
2016-02-16 23:09:35 +00:00
|
|
|
|
|
|
|
assert.deepEqual(messages, ['registerUrlSchemeAsSecure is deprecated. Use registerURLSchemeAsSecure instead.']);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('throws an exception if no deprecation handler is specified', function() {
|
|
|
|
assert.throws(function() {
|
2016-02-16 23:26:58 +00:00
|
|
|
require('electron').webFrame.registerUrlSchemeAsPrivileged('some-scheme');
|
2016-02-16 23:09:35 +00:00
|
|
|
}, "registerUrlSchemeAsPrivileged is deprecated. Use registerURLSchemeAsPrivileged instead.");
|
|
|
|
});
|
2016-02-16 23:26:58 +00:00
|
|
|
});
|