Bug 1593361 - Define UNICODE in vrhost to support sending UTF16 character input r=kip

This change defines UNICODE for building vrhost so that wide chars can be sent from vrhost to Firefox.

Differential Revision: https://phabricator.services.mozilla.com/D51470

--HG--
extra : moz-landing-system : lando
This commit is contained in:
thomasmo 2019-11-05 00:25:59 +00:00
Родитель c372471ea4
Коммит 6b9384e37b
3 изменённых файлов: 27 добавлений и 14 удалений

Просмотреть файл

@ -31,8 +31,6 @@ EXPORTS.vrhost = [
'vrhostex.h'
]
DIRS += [
'testhost'
]
@ -44,5 +42,9 @@ DEFINES['MOZ_NO_MOZALLOC'] = True
# fixes "STL code can only be used with infallible ::operator new()"
DisableStlWrapping()
# Define UNICODE for default support in this dll
DEFINES['UNICODE'] = True
DEFINES['_UNICODE'] = True
# Use SharedLibrary to generate the dll
SharedLibrary('vrhost')

Просмотреть файл

@ -94,19 +94,19 @@ struct StartFirefoxParams {
// Helper threadproc function for CreateVRWindow
DWORD StartFirefoxThreadProc(_In_ LPVOID lpParameter) {
char cmd[] = "%sfirefox.exe -wait-for-browser -profile %s --fxr";
wchar_t cmd[] = L"%Sfirefox.exe -wait-for-browser -profile %S --fxr";
StartFirefoxParams* params = static_cast<StartFirefoxParams*>(lpParameter);
char cmdWithPath[MAX_PATH + MAX_PATH] = {0};
int err = sprintf_s(cmdWithPath, ARRAYSIZE(cmdWithPath), cmd,
params->firefoxFolder, params->firefoxProfileFolder);
wchar_t cmdWithPath[MAX_PATH + MAX_PATH] = {0};
int err = swprintf_s(cmdWithPath, ARRAYSIZE(cmdWithPath), cmd,
params->firefoxFolder, params->firefoxProfileFolder);
if (err != -1) {
PROCESS_INFORMATION procFx = {0};
STARTUPINFO startupInfoFx = {0};
#if defined(DEBUG) && defined(NIGHTLY_BUILD)
printf("Starting Firefox via: %s\n", cmdWithPath);
printf("Starting Firefox via: %S\n", cmdWithPath);
#endif
// Start Firefox

Просмотреть файл

@ -264,7 +264,7 @@ void TestCreateVRWindow() {
char currentDir[MAX_PATH] = {0};
char currentDirProfile[MAX_PATH] = {0};
DWORD currentDirLength =
::GetCurrentDirectory(ARRAYSIZE(currentDir), currentDir);
::GetCurrentDirectoryA(ARRAYSIZE(currentDir), currentDir);
currentDir[currentDirLength] = '\\';
int err = sprintf_s(currentDirProfile, ARRAYSIZE(currentDirProfile),
@ -286,20 +286,24 @@ void TestCreateVRWindow() {
(void*)fnWaitForVRMsg, 0, &dwTid);
// Wait for Fx to finish launch
#ifdef DEBUG
::Sleep(5000);
#else
::Sleep(2000);
#endif
printf(
"Now, simulating a click on the Home button, which should look "
"1. Simulating a click on the Home button, which should look "
"pressed\n");
POINT pt;
pt.x = 180;
pt.y = 790;
pt.y = 700;
fnSendMsg(windowId, WM_LBUTTONDOWN, 0, POINTTOPOINTS(pt));
::Sleep(3000);
fnSendMsg(windowId, WM_LBUTTONUP, 0, POINTTOPOINTS(pt));
printf(
"Next, simulating hovering across the URL bar, which should turn "
"2. Simulating hovering across the URL bar, which should turn "
"blue\n");
pt.x = 600;
for (int i = 0; i < 100; ++i) {
@ -309,16 +313,23 @@ void TestCreateVRWindow() {
}
printf(
"Next, simulating clicking inside the URL bar, which should "
"3. Simulating clicking inside the URL bar, which should "
"highlight the text\n");
pt.x = 700;
pt.y = 790;
pt.y = 700;
fnSendMsg(windowId, WM_LBUTTONDOWN, 0, POINTTOPOINTS(pt));
fnSendMsg(windowId, WM_LBUTTONUP, 0, POINTTOPOINTS(pt));
::Sleep(3000);
printf("4. Type some UTF16 characters in the URL bar\n");
fnSendMsg(windowId, WM_CHAR, 0x4E64, 0);
fnSendMsg(windowId, WM_CHAR, 0x312D, 0);
fnSendMsg(windowId, WM_CHAR, 0x0BB9, 0);
fnSendMsg(windowId, WM_CHAR, 0x2745, 0);
printf(
"Finally, simulating clicking outside the URL bar, which should "
"5. Simulating clicking outside the URL bar, which should "
"send a keyboard blur event\n");
pt.x = 80;
fnSendMsg(windowId, WM_LBUTTONDOWN, 0, POINTTOPOINTS(pt));