Skip to content
Permalink
Browse files
tests fail if display sleeps while run-webkit-tests is running
https://bugs.webkit.org/show_bug.cgi?id=153919

Reviewed by Alexey Proskuryakov.

* DumpRenderTree/mac/LayoutTestHelper.m:
(releaseSleepAssertions): Release both Display sleep and System sleep assertions.
(addSleepAssertions): Add sleep assertion for both Display sleep and System sleep.


Canonical link: https://commits.webkit.org/176604@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@201821 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aj062 committed Jun 8, 2016
1 parent 8f43782 commit 9a6f8e3be050738946d6734c8d338794ba289ba8
Showing 2 changed files with 23 additions and 8 deletions.
@@ -1,3 +1,14 @@
2016-06-08 Aakash Jain <aakash_jain@apple.com>

tests fail if display sleeps while run-webkit-tests is running
https://bugs.webkit.org/show_bug.cgi?id=153919

Reviewed by Alexey Proskuryakov.

* DumpRenderTree/mac/LayoutTestHelper.m:
(releaseSleepAssertions): Release both Display sleep and System sleep assertions.
(addSleepAssertions): Add sleep assertion for both Display sleep and System sleep.

2016-06-08 Lucas Forschler <lforschler@apple.com>

Reverted changeset 201814.
@@ -47,7 +47,8 @@
// running layout tests.

static int installColorProfile = false;
static uint32_t assertionID = 0;
static uint32_t assertionIDForDisplaySleep = 0;
static uint32_t assertionIDForSystemSleep = 0;

static NSMutableDictionary *originalColorProfileURLs()
{
@@ -195,16 +196,17 @@ static void restoreUserColorProfile(void)
restoreDisplayColorProfiles(displays);
}

static void releaseDisplaySleepAssertion()
static void releaseSleepAssertions()
{
IOPMAssertionRelease(assertionID);
IOPMAssertionRelease(assertionIDForDisplaySleep);
IOPMAssertionRelease(assertionIDForSystemSleep);
}

static void simpleSignalHandler(int sig)
{
// Try to restore the color profile and try to go down cleanly
restoreUserColorProfile();
releaseDisplaySleepAssertion();
releaseSleepAssertions();
exit(128 + sig);
}

@@ -240,12 +242,14 @@ void lockDownDiscreteGraphics()
NSLog(@"IOObjectRelease() failed in %s with kernResult = %d", __FUNCTION__, kernResult);
}

void addDisplaySleepAssertion()
void addSleepAssertions()
{
CFStringRef assertionName = CFSTR("WebKit LayoutTestHelper");
CFStringRef assertionDetails = CFSTR("WebKit layout-test helper tool is preventing sleep.");
IOPMAssertionCreateWithDescription(kIOPMAssertionTypePreventUserIdleDisplaySleep,
assertionName, assertionDetails, assertionDetails, NULL, 0, NULL, &assertionIDForDisplaySleep);
IOPMAssertionCreateWithDescription(kIOPMAssertionTypePreventUserIdleSystemSleep,
assertionName, assertionDetails, assertionDetails, NULL, 0, NULL, &assertionID);
assertionName, assertionDetails, assertionDetails, NULL, 0, NULL, &assertionIDForSystemSleep);
}

int main(int argc, char* argv[])
@@ -269,7 +273,7 @@ int main(int argc, char* argv[])
signal(SIGHUP, simpleSignalHandler);
signal(SIGTERM, simpleSignalHandler);

addDisplaySleepAssertion();
addSleepAssertions();
lockDownDiscreteGraphics();

// Save off the current profile, and then install the layout test profile.
@@ -284,7 +288,7 @@ int main(int argc, char* argv[])

// Restore the profile
restoreUserColorProfile();
releaseDisplaySleepAssertion();
releaseSleepAssertions();

return 0;
}

0 comments on commit 9a6f8e3

Please sign in to comment.