Changeset 196212 in webkit


Ignore:
Timestamp:
Feb 5, 2016 11:00:56 PM (8 years ago)
Author:
aakash_jain@apple.com
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:

(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.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r196189 r196212  
     12016-02-05  Aakash Jain  <aakash_jain@apple.com>
     2
     3        tests fail if display sleeps while run-webkit-tests is running
     4        https://bugs.webkit.org/show_bug.cgi?id=153919
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        * DumpRenderTree/mac/LayoutTestHelper.m:
     9        (addDisplaySleepAssertion): Add the assertion so that the display doesn't turn off.
     10        (releaseDisplaySleepAssertion): Release the DisplaySleep Assertion.
     11        (simpleSignalHandler): Release the DisplaySleepAssertion in case of any iterrupt.
     12
    1132016-02-05  Alex Christensen  <achristensen@webkit.org>
    214
  • trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m

    r189639 r196212  
    3434#import <AppKit/AppKit.h>
    3535#import <ApplicationServices/ApplicationServices.h>
     36#import <IOKit/pwr_mgt/IOPMLib.h>
    3637#import <getopt.h>
    3738#import <signal.h>
     
    4546
    4647static int installColorProfile = false;
     48static uint32_t assertionID = 0;
    4749
    4850static NSMutableDictionary *originalColorProfileURLs()
     
    192194}
    193195
     196static void releaseDisplaySleepAssertion()
     197{
     198    IOPMAssertionRelease(assertionID);
     199}
     200
    194201static void simpleSignalHandler(int sig)
    195202{
    196203    // Try to restore the color profile and try to go down cleanly
    197204    restoreUserColorProfile();
     205    releaseDisplaySleepAssertion();
    198206    exit(128 + sig);
    199207}
     
    229237    if (kernResult != KERN_SUCCESS)
    230238        NSLog(@"IOObjectRelease() failed in %s with kernResult = %d", __FUNCTION__, kernResult);
     239}
     240
     241void addDisplaySleepAssertion()
     242{
     243    CFStringRef assertionName = CFSTR("WebKit LayoutTestHelper");
     244    CFStringRef assertionDetails = CFSTR("WebKit layout-test helper tool is preventing sleep.");
     245    IOPMAssertionCreateWithDescription(kIOPMAssertionTypePreventUserIdleDisplaySleep,
     246        assertionName, assertionDetails, assertionDetails, NULL, 0, NULL, &assertionID);
    231247}
    232248
     
    252268    signal(SIGTERM, simpleSignalHandler);
    253269
     270    addDisplaySleepAssertion();
    254271    lockDownDiscreteGraphics();
    255272
     
    266283    // Restore the profile
    267284    restoreUserColorProfile();
     285    releaseDisplaySleepAssertion();
    268286
    269287    return 0;
Note: See TracChangeset for help on using the changeset viewer.