From 58d58c7b9d95c57f6bd9266c15fe173bb3264cc8 Mon Sep 17 00:00:00 2001 From: "amit@chromium.org" Date: Fri, 5 Nov 2010 23:34:03 +0000 Subject: Some input tests no longer marked flaky For tests like CtrlW, CtrlN it's better to notice failures when they execute and not run them at all if the workstation is locked i.e. when they will certainly fail. Added a check to do exactly that :) BUG=none TESTS=CtrlR, CtrlW, CtrlN, CtrlF, AltD Review URL: http://codereview.chromium.org/4615001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65279 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/test_utils.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'chrome_frame/test_utils.cc') diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc index a059b35..d146079 100644 --- a/chrome_frame/test_utils.cc +++ b/chrome_frame/test_utils.cc @@ -303,3 +303,21 @@ bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, return result; } + +bool IsWorkstationLocked() { + bool is_locked = true; + HDESK input_desk = ::OpenInputDesktop(0, 0, GENERIC_READ); + if (input_desk) { + wchar_t name[256] = {0}; + DWORD needed = 0; + if (::GetUserObjectInformation(input_desk, + UOI_NAME, + name, + sizeof(name), + &needed)) { + is_locked = lstrcmpi(name, L"default") != 0; + } + ::CloseDesktop(input_desk); + } + return is_locked; +} -- cgit v1.1