rename importClientCertificate => importCertificate

This commit is contained in:
deepak1556 2016-04-20 08:45:49 +05:30
parent 2d8286515d
commit 794d120754
4 changed files with 20 additions and 8 deletions

View file

@ -167,7 +167,7 @@ int ImportIntoCertStore(
base::string16 password;
net::CertificateList imported_certs;
int rv = -1;
options.GetString("clientCertificate", &cert_path);
options.GetString("certificate", &cert_path);
options.GetString("password", &password);
if (!cert_path.empty()) {
@ -405,7 +405,7 @@ bool App::MakeSingleInstance(
}
#if defined(USE_NSS_CERTS)
void App::ImportClientCertificate(
void App::ImportCertificate(
const base::DictionaryValue& options,
const net::CompletionCallback& callback) {
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
@ -474,7 +474,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
&App::AllowNTLMCredentialsForAllDomains)
.SetMethod("getLocale", &App::GetLocale)
#if defined(USE_NSS_CERTS)
.SetMethod("importClientCertificate", &App::ImportClientCertificate)
.SetMethod("importCertificate", &App::ImportCertificate)
#endif
.SetMethod("makeSingleInstance", &App::MakeSingleInstance);
}

View file

@ -111,7 +111,7 @@ class App : public AtomBrowserClient::Delegate,
std::string GetLocale();
#if defined(USE_NSS_CERTS)
void ImportClientCertificate(const base::DictionaryValue& options,
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
#endif

View file

@ -514,6 +514,18 @@ if (browserOptions.transparent) {
This method returns `true` if the system is in Dark Mode, and `false` otherwise.
### `app.importCertificate(options, callback)` _LINUX_
* `options` Object
* `certificate` String - Path for the pkcs12 file.
* `password` String - Passphrase for the certificate.
* `callback` Function
* `result` Integer - Result of import.
Imports the certificate in pkcs12 format into the platform certificate store.
`callback` is called with the `result` of import operation, a value of `0` indicates
success while any other value indicates failure according to chromium [net_error_list](https://code.google.com/p/chromium/codesearch#chromium/src/net/base/net_error_list.h).
### `app.commandLine.appendSwitch(switch[, value])`
Append a switch (with optional `value`) to Chromium's command line.

View file

@ -89,7 +89,7 @@ describe('app module', function () {
})
})
describe('app.importClientCertificate', function () {
describe('app.importCertificate', function () {
if (process.platform !== 'linux')
return
@ -124,7 +124,7 @@ describe('app module', function () {
it('can import certificate into platform cert store', function (done) {
let options = {
clientCertificate: path.join(certPath, 'client.p12'),
certificate: path.join(certPath, 'client.p12'),
password: 'electron'
}
@ -143,7 +143,7 @@ describe('app module', function () {
callback(list[0])
})
app.importClientCertificate(options, function (result) {
app.importCertificate(options, function (result) {
assert(!result)
server.listen(0, '127.0.0.1', function () {
var port = server.address().port