native messaging host tests

This commit is contained in:
antelle 2021-04-14 21:11:24 +02:00
parent 27b116798e
commit f893dcb19a
No known key found for this signature in database
GPG Key ID: 63C9777AAB7C563C
2 changed files with 5 additions and 3 deletions

View File

@ -49,7 +49,7 @@ std::string keeweb_pipe_name() {
std::cerr << "Error getting user: " << uv_err_name(err) << std::endl;
} else {
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32)
pipe_name = "\\\\.pipe\\keeweb-browser-" + std::string{user_info.username} + ".sock";
pipe_name = "\\\\.\\pipe\\keeweb-browser-" + std::string{user_info.username};
#else
pipe_name = std::filesystem::temp_directory_path() /
("keeweb-browser-" + std::to_string(user_info.uid) + ".sock");

View File

@ -6,15 +6,17 @@ import childProcess from 'child_process';
import { expect } from 'chai';
describe('KeeWeb extension native module host', function () {
const hostPath = 'build/keeweb-native-messaging-host';
const extensionOrigin = 'keeweb-connect@keeweb.info';
const userInfo = os.userInfo();
let sockPath;
let hostPath;
if (process.platform === 'win32') {
sockPath = `\\\\.pipe\\keeweb-browser-${userInfo.username}`;
sockPath = `\\\\.\\pipe\\keeweb-browser-${userInfo.username}`;
hostPath = 'build\\Debug\\keeweb-native-messaging-host.exe';
} else {
sockPath = path.join(os.tmpdir(), `keeweb-browser-${userInfo.uid}.sock`);
hostPath = 'build/keeweb-native-messaging-host';
}
let server;