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:
(addDisplaySleepAssertion): Add the assertion so that the display doesn't turn off.
(releaseDisplaySleepAssertion): Release the DisplaySleep Assertion.
(simpleSignalHandler): Release the DisplaySleepAssertion in case of any iterrupt.


Canonical link: https://commits.webkit.org/172039@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
aj062 committed Feb 6, 2016
1 parent e24c6da commit de6fe7c52341ca1f256fbde9b487f8b61459f7d8
Showing 2 changed files with 30 additions and 0 deletions.
@@ -1,3 +1,15 @@
2016-02-05 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:
(addDisplaySleepAssertion): Add the assertion so that the display doesn't turn off.
(releaseDisplaySleepAssertion): Release the DisplaySleep Assertion.
(simpleSignalHandler): Release the DisplaySleepAssertion in case of any iterrupt.

2016-02-05 Alex Christensen <achristensen@webkit.org>

Fix iOS API tests after r196082
@@ -33,6 +33,7 @@

#import <AppKit/AppKit.h>
#import <ApplicationServices/ApplicationServices.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
#import <getopt.h>
#import <signal.h>
#import <stdio.h>
@@ -44,6 +45,7 @@
// running layout tests.

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

static NSMutableDictionary *originalColorProfileURLs()
{
@@ -191,10 +193,16 @@ static void restoreUserColorProfile(void)
restoreDisplayColorProfiles(displays);
}

static void releaseDisplaySleepAssertion()
{
IOPMAssertionRelease(assertionID);
}

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

@@ -230,6 +238,14 @@ void lockDownDiscreteGraphics()
NSLog(@"IOObjectRelease() failed in %s with kernResult = %d", __FUNCTION__, kernResult);
}

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

int main(int argc, char* argv[])
{
struct option options[] = {
@@ -251,6 +267,7 @@ int main(int argc, char* argv[])
signal(SIGHUP, simpleSignalHandler);
signal(SIGTERM, simpleSignalHandler);

addDisplaySleepAssertion();
lockDownDiscreteGraphics();

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

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

return 0;
}

0 comments on commit de6fe7c

Please sign in to comment.