fix code style
This commit is contained in:
parent
06701786c4
commit
cbddbdb296
3 changed files with 28 additions and 9 deletions
|
@ -378,12 +378,24 @@ void OnClientCertificateSelected(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
std::shared_ptr<content::ClientCertificateDelegate> delegate,
|
std::shared_ptr<content::ClientCertificateDelegate> delegate,
|
||||||
mate::Arguments* args) {
|
mate::Arguments* args) {
|
||||||
mate::Dictionary cert_data;
|
if (args->Length() == 2) {
|
||||||
if (!args->GetNext(&cert_data)) {
|
|
||||||
delegate->ContinueWithCertificate(nullptr);
|
delegate->ContinueWithCertificate(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v8::Local<v8::Value> val;
|
||||||
|
args->GetNext(&val);
|
||||||
|
if (val->IsNull()) {
|
||||||
|
delegate->ContinueWithCertificate(nullptr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mate::Dictionary cert_data;
|
||||||
|
if (!mate::ConvertFromV8(isolate, val, &cert_data)) {
|
||||||
|
args->ThrowError("Must pass valid certificate object.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
if (!cert_data.Get("data", &data))
|
if (!cert_data.Get("data", &data))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -220,6 +220,16 @@ describe('app module', function () {
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
ipcRenderer.once('select-client-certificate', function (event, webContentsId, list) {
|
||||||
|
assert.equal(webContentsId, w.webContents.id)
|
||||||
|
assert.equal(list.length, 1)
|
||||||
|
assert.equal(list[0].issuerName, 'Intermediate CA')
|
||||||
|
assert.equal(list[0].subjectName, 'Client Cert')
|
||||||
|
assert.equal(list[0].issuer.commonName, 'Intermediate CA')
|
||||||
|
assert.equal(list[0].subject.commonName, 'Client Cert')
|
||||||
|
event.sender.send('client-certificate-response', list[0])
|
||||||
|
})
|
||||||
|
|
||||||
app.importCertificate(options, function (result) {
|
app.importCertificate(options, function (result) {
|
||||||
assert(!result)
|
assert(!result)
|
||||||
ipcRenderer.sendSync('set-client-certificate-option', false)
|
ipcRenderer.sendSync('set-client-certificate-option', false)
|
||||||
|
|
|
@ -11,7 +11,6 @@ const protocol = electron.protocol
|
||||||
const v8 = require('v8')
|
const v8 = require('v8')
|
||||||
|
|
||||||
const Coverage = require('electabul').Coverage
|
const Coverage = require('electabul').Coverage
|
||||||
const assert = require('assert')
|
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const url = require('url')
|
const url = require('url')
|
||||||
|
@ -192,12 +191,10 @@ ipcMain.on('set-client-certificate-option', function (event, skip) {
|
||||||
if (skip) {
|
if (skip) {
|
||||||
callback()
|
callback()
|
||||||
} else {
|
} else {
|
||||||
assert.equal(list.length, 1)
|
ipcMain.on('client-certificate-response', function (event, certificate) {
|
||||||
assert.equal(list[0].issuerName, 'Intermediate CA')
|
callback(certificate)
|
||||||
assert.equal(list[0].subjectName, 'Client Cert')
|
})
|
||||||
assert.equal(list[0].issuer.commonName, 'Intermediate CA')
|
window.webContents.send('select-client-certificate', webContents.id, list)
|
||||||
assert.equal(list[0].subject.commonName, 'Client Cert')
|
|
||||||
callback(list[0])
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
event.returnValue = 'done'
|
event.returnValue = 'done'
|
||||||
|
|
Loading…
Reference in a new issue