From d866f0cf8ae9de653c9bc963f9e5a44ed025677e Mon Sep 17 00:00:00 2001 From: Jim Mathies Date: Thu, 9 May 2013 13:37:41 -0500 Subject: [PATCH] Bug 864940 - Only hand off focus rights to explorer if the test console has focus. r=bbondy --- browser/metro/shell/testing/metrotestharness.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/browser/metro/shell/testing/metrotestharness.cpp b/browser/metro/shell/testing/metrotestharness.cpp index 486f0a6388da..859f6f50b5da 100644 --- a/browser/metro/shell/testing/metrotestharness.cpp +++ b/browser/metro/shell/testing/metrotestharness.cpp @@ -219,12 +219,15 @@ static bool Launch() } Log(L"App model id='%s'", appModelID); - // Hand off focus rights to the out-of-process activation server. Without - // this the metro interface won't launch. - hr = CoAllowSetForegroundWindow(activateMgr, NULL); - if (FAILED(hr)) { - Fail(L"CoAllowSetForegroundWindow result %X", hr); - return false; + // Hand off focus rights if the terminal has focus to the out-of-process + // activation server (explorer.exe). Without this the metro interface + // won't launch. + if (GetForegroundWindow() == GetConsoleWindow()) { + hr = CoAllowSetForegroundWindow(activateMgr, NULL); + if (FAILED(hr)) { + Fail(L"CoAllowSetForegroundWindow result %X", hr); + return false; + } } Log(L"Harness process id: %d", GetCurrentProcessId());