Title: [201821] trunk/Tools
Revision
201821
Author
aakash_j...@apple.com
Date
2016-06-08 12:17:52 -0700 (Wed, 08 Jun 2016)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (201820 => 201821)


--- trunk/Tools/ChangeLog	2016-06-08 18:52:37 UTC (rev 201820)
+++ trunk/Tools/ChangeLog	2016-06-08 19:17:52 UTC (rev 201821)
@@ -1,3 +1,14 @@
+2016-06-08  Aakash Jain  <aakash_j...@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  <lforsch...@apple.com>
 
         Reverted changeset 201814.

Modified: trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m (201820 => 201821)


--- trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m	2016-06-08 18:52:37 UTC (rev 201820)
+++ trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m	2016-06-08 19:17:52 UTC (rev 201821)
@@ -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 @@
     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 @@
         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 @@
     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 @@
 
     // Restore the profile
     restoreUserColorProfile();
-    releaseDisplaySleepAssertion();
+    releaseSleepAssertions();
 
     return 0;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to