Implementation and further tests for #220

This commit is contained in:
Yuya Ochiai
2016-08-08 23:56:21 +09:00
parent 54849d6859
commit ce6cf485f6
3 changed files with 30 additions and 6 deletions

View File

@@ -78,12 +78,28 @@ describe('application', function() {
.windowByIndex(3).isNodeEnabled().should.eventually.be.false;
});
it('should NOT be able to call eval in any window', function() {
it('should NOT be able to call eval() in any window', function() {
env.addClientCommands(this.app.client);
const client = this.app.client;
return this.app.client
.windowByIndex(1) // in the first webview
.eval()
.should.be.rejected;
const tryEval = (index) => {
return this.app.client
.windowByIndex(index)
.execute(function() {
return eval('1 + 1');
}).should.eventually.be.rejected;
};
const tryEvalInSettingsPage = () => {
return this.app.client
.windowByIndex(0)
.loadSettingsPage()
.execute(function() {
return eval('1 + 1');
}).should.eventually.be.rejected;
};
return Promise.all([
tryEval(0),
tryEval(1),
tryEval(2),
tryEvalInSettingsPage()
]);
});
});