Diff
Modified: trunk/Tools/ChangeLog (111428 => 111429)
--- trunk/Tools/ChangeLog 2012-03-20 19:53:36 UTC (rev 111428)
+++ trunk/Tools/ChangeLog 2012-03-20 19:58:02 UTC (rev 111429)
@@ -1,3 +1,31 @@
+2012-03-20 Tim Horton <[email protected]>
+
+ [mac] Restore color space switching code to run-webkit-tests
+ https://bugs.webkit.org/show_bug.cgi?id=80571
+ <rdar://problem/11008529>
+
+ Reviewed by Simon Fraser.
+
+ Make use of the layout test helper hooks to restore the Mac system-wide
+ color profile switching code. This makes WkTR and DRT results match, and
+ causes the main display's color profile to not affect results on Lion.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/mac/LayoutTestHelper.m: Added.
+ (installLayoutTestColorProfile):
+ (restoreUserColorProfile):
+ (simpleSignalHandler):
+ (main):
+ * Scripts/webkitpy/layout_tests/port/mac.py:
+ (MacPort.release_http_lock):
+ (MacPort):
+ (MacPort._path_to_helper):
+ (MacPort.start_helper):
+ (MacPort.stop_helper):
+ * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+ (WTR::PlatformWebView::PlatformWebView):
+ (WTR::PlatformWebView::windowSnapshotImage):
+
2012-02-24 Darin Fisher <[email protected]>
Add more Chromium WebKit API reviewers
Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (111428 => 111429)
--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2012-03-20 19:53:36 UTC (rev 111428)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj 2012-03-20 19:58:02 UTC (rev 111429)
@@ -13,6 +13,7 @@
buildPhases = (
);
dependencies = (
+ 2D403F211508736C005358D2 /* PBXTargetDependency */,
A84F609108B1370E00E9745F /* PBXTargetDependency */,
A84F608F08B1370E00E9745F /* PBXTargetDependency */,
141BF238096A451E00E0753C /* PBXTargetDependency */,
@@ -55,6 +56,10 @@
29CFBA10122736E600BC30C0 /* AccessibilityTextMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CFBA0E122736E600BC30C0 /* AccessibilityTextMarker.h */; };
29CFBA11122736E600BC30C0 /* AccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA0F122736E600BC30C0 /* AccessibilityTextMarker.cpp */; };
29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */; };
+ 2D403F05150871F9005358D2 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
+ 2D403F06150871F9005358D2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; };
+ 2D403F08150871F9005358D2 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 23BCB88F0EA57623003C6289 /* OpenGL.framework */; };
+ 2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D403EA215087142005358D2 /* LayoutTestHelper.m */; };
3A5626CB131CA02A002BE6D9 /* StorageTrackerDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3A5626C1131C8B17002BE6D9 /* StorageTrackerDelegate.mm */; };
3A5626CC131CA036002BE6D9 /* StorageTrackerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 3A5626C0131C8B17002BE6D9 /* StorageTrackerDelegate.h */; };
417DAA1D137B3E24007C57FB /* WebCoreTestSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 417DAA1C137B3E24007C57FB /* WebCoreTestSupport.h */; };
@@ -161,6 +166,13 @@
remoteGlobalIDString = 141BF21E096A441D00E0753C;
remoteInfo = TestNetscapePlugIn;
};
+ 2D403F201508736C005358D2 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 2D403EB2150871F9005358D2;
+ remoteInfo = LayoutTestHelper;
+ };
5DC82A6F1023C93D00FD1D3B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
@@ -236,6 +248,8 @@
29CFBA0E122736E600BC30C0 /* AccessibilityTextMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityTextMarker.h; sourceTree = "<group>"; };
29CFBA0F122736E600BC30C0 /* AccessibilityTextMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityTextMarker.cpp; sourceTree = "<group>"; };
29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = AccessibilityTextMarkerMac.mm; path = mac/AccessibilityTextMarkerMac.mm; sourceTree = "<group>"; };
+ 2D403EA215087142005358D2 /* LayoutTestHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LayoutTestHelper.m; path = mac/LayoutTestHelper.m; sourceTree = "<group>"; };
+ 2D403F19150871F9005358D2 /* LayoutTestHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = LayoutTestHelper; sourceTree = BUILT_PRODUCTS_DIR; };
32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
375F09710DAC3CB600C8B4E5 /* WebKitWeightWatcher100.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher100.ttf; path = fonts/WebKitWeightWatcher100.ttf; sourceTree = "<group>"; };
375F09720DAC3CB600C8B4E5 /* WebKitWeightWatcher200.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = WebKitWeightWatcher200.ttf; path = fonts/WebKitWeightWatcher200.ttf; sourceTree = "<group>"; };
@@ -356,6 +370,16 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 2D403F03150871F9005358D2 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2D403F05150871F9005358D2 /* Carbon.framework in Frameworks */,
+ 2D403F06150871F9005358D2 /* Cocoa.framework in Frameworks */,
+ 2D403F08150871F9005358D2 /* OpenGL.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
9340994F08540CAE007F3BC8 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -409,6 +433,7 @@
A8B91AD20CF3B305008F91FF /* AppKit Overrides */,
A8B91AC40CF3B170008F91FF /* ObjCPlugin */,
141BF1F5096A439800E0753C /* TestNetscapePlugIn */,
+ 2D403EA015087135005358D2 /* LayoutTestHelper */,
9345229B0BD12B2C0086EDA0 /* Resources */,
417DA9181373674D007C57FB /* WebCoreTestSupport */,
A803FF6409CAACC1009B2A37 /* Frameworks */,
@@ -526,6 +551,14 @@
path = mac;
sourceTree = "<group>";
};
+ 2D403EA015087135005358D2 /* LayoutTestHelper */ = {
+ isa = PBXGroup;
+ children = (
+ 2D403EA215087142005358D2 /* LayoutTestHelper.m */,
+ );
+ name = LayoutTestHelper;
+ sourceTree = "<group>";
+ };
417DA9181373674D007C57FB /* WebCoreTestSupport */ = {
isa = PBXGroup;
children = (
@@ -540,6 +573,7 @@
9340995408540CAF007F3BC8 /* DumpRenderTree */,
B5A7526708AF4A4A00138E45 /* ImageDiff */,
141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */,
+ 2D403F19150871F9005358D2 /* LayoutTestHelper */,
);
name = Products;
sourceTree = "<group>";
@@ -727,6 +761,23 @@
productReference = 141BF233096A44CF00E0753C /* TestNetscapePlugIn.plugin */;
productType = "com.apple.product-type.bundle";
};
+ 2D403EB2150871F9005358D2 /* LayoutTestHelper */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 2D403F15150871F9005358D2 /* Build configuration list for PBXNativeTarget "LayoutTestHelper" */;
+ buildPhases = (
+ 2D403ED8150871F9005358D2 /* Sources */,
+ 2D403F03150871F9005358D2 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = LayoutTestHelper;
+ productInstallPath = "$(HOME)/bin";
+ productName = DumpRenderTree;
+ productReference = 2D403F19150871F9005358D2 /* LayoutTestHelper */;
+ productType = "com.apple.product-type.tool";
+ };
9340994A08540CAE007F3BC8 /* DumpRenderTree */ = {
isa = PBXNativeTarget;
buildConfigurationList = 149C29BF08902C6D008A9EFC /* Build configuration list for PBXNativeTarget "DumpRenderTree" */;
@@ -789,6 +840,7 @@
B5A7525A08AF4A4A00138E45 /* ImageDiff */,
141BF21E096A441D00E0753C /* TestNetscapePlugIn */,
5DC82A661023C8DE00FD1D3B /* DumpRenderTree Perl Support */,
+ 2D403EB2150871F9005358D2 /* LayoutTestHelper */,
);
};
/* End PBXProject section */
@@ -834,6 +886,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
+ 2D403ED8150871F9005358D2 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
9340994D08540CAE007F3BC8 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -898,6 +958,11 @@
target = 141BF21E096A441D00E0753C /* TestNetscapePlugIn */;
targetProxy = 141BF237096A451E00E0753C /* PBXContainerItemProxy */;
};
+ 2D403F211508736C005358D2 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 2D403EB2150871F9005358D2 /* LayoutTestHelper */;
+ targetProxy = 2D403F201508736C005358D2 /* PBXContainerItemProxy */;
+ };
5DC82A701023C93D00FD1D3B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 5DC82A661023C8DE00FD1D3B /* DumpRenderTree Perl Support */;
@@ -961,6 +1026,32 @@
};
name = Release;
};
+ 2D403F16150871F9005358D2 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */;
+ buildSettings = {
+ PRODUCT_NAME = LayoutTestHelper;
+ };
+ name = Debug;
+ };
+ 2D403F17150871F9005358D2 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */;
+ buildSettings = {
+ PRODUCT_NAME = LayoutTestHelper;
+ };
+ name = Release;
+ };
+ 2D403F18150871F9005358D2 /* Production */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = BCB281F00CFA713D007E533E /* DumpRenderTree.xcconfig */;
+ buildSettings = {
+ INSTALL_PATH = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(WEBKIT_FRAMEWORK_RESOURCES_PATH)";
+ PRODUCT_NAME = LayoutTestHelper;
+ SKIP_INSTALL = NO;
+ };
+ name = Production;
+ };
5DC82A671023C8DE00FD1D3B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -1109,6 +1200,16 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Production;
};
+ 2D403F15150871F9005358D2 /* Build configuration list for PBXNativeTarget "LayoutTestHelper" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 2D403F16150871F9005358D2 /* Debug */,
+ 2D403F17150871F9005358D2 /* Release */,
+ 2D403F18150871F9005358D2 /* Production */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Production;
+ };
5DC82A6E1023C92A00FD1D3B /* Build configuration list for PBXLegacyTarget "DumpRenderTree Perl Support" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Added: trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m (0 => 111429)
--- trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m (rev 0)
+++ trunk/Tools/DumpRenderTree/mac/LayoutTestHelper.m 2012-03-20 19:58:02 UTC (rev 111429)
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Apple Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <AppKit/AppKit.h>
+#import <ApplicationServices/ApplicationServices.h>
+#import <signal.h>
+#import <stdio.h>
+#import <stdlib.h>
+
+// This is a simple helper app that changes the color profile of the main display
+// to GenericRGB and back when done. This program is managed by the layout
+// test script, so it can do the job for multiple DumpRenderTree while they are
+// running layout tests.
+
+static CFURLRef sUserColorProfileURL;
+
+static void installLayoutTestColorProfile()
+{
+ // To make sure we get consistent colors (not dependent on the chosen color
+ // space of the main display), we force the generic RGB color profile.
+ // This causes a change the user can see.
+
+ CFUUIDRef mainDisplayID = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID());
+
+ if (!sUserColorProfileURL) {
+ CFDictionaryRef deviceInfo = ColorSyncDeviceCopyDeviceInfo(kColorSyncDisplayDeviceClass, mainDisplayID);
+ CFDictionaryRef profileInfo = (CFDictionaryRef)CFDictionaryGetValue(deviceInfo, kColorSyncCustomProfiles);
+ if (profileInfo) {
+ sUserColorProfileURL = (CFURLRef)CFDictionaryGetValue(profileInfo, CFSTR("1"));
+ CFRetain(sUserColorProfileURL);
+ }
+
+ CFRelease(deviceInfo);
+ }
+
+ ColorSyncProfileRef genericRGBProfile = ColorSyncProfileCreateWithName(kColorSyncGenericRGBProfile);
+ CFErrorRef error;
+ CFURLRef profileURL = ColorSyncProfileGetURL(genericRGBProfile, &error);
+ if (!profileURL) {
+ NSLog(@"Failed to get URL of Generic RGB color profile! Many pixel tests may fail as a result. Error: %@", error);
+
+ if (sUserColorProfileURL) {
+ CFRelease(sUserColorProfileURL);
+ sUserColorProfileURL = 0;
+ }
+
+ CFRelease(genericRGBProfile);
+ CFRelease(mainDisplayID);
+ return;
+ }
+
+ CFMutableDictionaryRef profileInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, profileURL);
+
+ if (!ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo)) {
+ fprintf(stderr, "Failed to set color profile for main display! Many pixel tests may fail as a result.\n");
+
+ if (sUserColorProfileURL) {
+ CFRelease(sUserColorProfileURL);
+ sUserColorProfileURL = 0;
+ }
+ }
+
+ CFRelease(profileInfo);
+ CFRelease(genericRGBProfile);
+ CFRelease(mainDisplayID);
+}
+
+static void restoreUserColorProfile(void)
+{
+ // This is used as a signal handler, and thus the calls into ColorSync are unsafe.
+ // But we might as well try to restore the user's color profile, we're going down anyway...
+
+ if (!sUserColorProfileURL)
+ return;
+
+ CFUUIDRef mainDisplayID = CGDisplayCreateUUIDFromDisplayID(CGMainDisplayID());
+ CFMutableDictionaryRef profileInfo = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionarySetValue(profileInfo, kColorSyncDeviceDefaultProfileID, sUserColorProfileURL);
+ ColorSyncDeviceSetCustomProfiles(kColorSyncDisplayDeviceClass, mainDisplayID, profileInfo);
+ CFRelease(mainDisplayID);
+ CFRelease(profileInfo);
+}
+
+static void simpleSignalHandler(int sig)
+{
+ // Try to restore the color profile and try to go down cleanly
+ restoreUserColorProfile();
+ exit(128 + sig);
+}
+
+int main(int argc, char* argv[])
+{
+ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
+
+ // Hooks the ways we might get told to clean up...
+ signal(SIGINT, simpleSignalHandler);
+ signal(SIGHUP, simpleSignalHandler);
+ signal(SIGTERM, simpleSignalHandler);
+
+ // Save off the current profile, and then install the layout test profile.
+ installLayoutTestColorProfile();
+
+ // Let the script know we're ready
+ printf("ready\n");
+ fflush(stdout);
+
+ // Wait for any key (or signal)
+ getchar();
+
+ // Restore the profile
+ restoreUserColorProfile();
+
+ [pool release];
+ return 0;
+}
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py (111428 => 111429)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py 2012-03-20 19:53:36 UTC (rev 111428)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/mac.py 2012-03-20 19:58:02 UTC (rev 111429)
@@ -28,6 +28,7 @@
import logging
import re
+import subprocess
from webkitpy.layout_tests.port.apple import ApplePort
from webkitpy.layout_tests.port.leakdetector import LeakDetector
@@ -158,3 +159,25 @@
def release_http_lock(self):
pass
+
+ def _path_to_helper(self):
+ binary_name = 'LayoutTestHelper'
+ return self._build_path(binary_name)
+
+ def start_helper(self):
+ helper_path = self._path_to_helper()
+ if helper_path:
+ _log.debug("Starting layout helper %s" % helper_path)
+ # Note: Not thread safe: http://bugs.python.org/issue2320
+ self._helper = subprocess.Popen([helper_path],
+ stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None)
+ is_ready = self._helper.stdout.readline()
+ if not is_ready.startswith('ready'):
+ _log.error("LayoutTestHelper failed to be ready")
+
+ def stop_helper(self):
+ if self._helper:
+ _log.debug("Stopping LayoutTestHelper")
+ self._helper.stdin.write("x\n")
+ self._helper.stdin.close()
+ self._helper.wait()
Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (111428 => 111429)
--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm 2012-03-20 19:53:36 UTC (rev 111428)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm 2012-03-20 19:58:02 UTC (rev 111429)
@@ -132,9 +132,8 @@
{
[m_view display];
RetainPtr<CGImageRef> windowSnapshotImage(AdoptCF, CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, [m_window windowNumber], kCGWindowImageBoundsIgnoreFraming | kCGWindowImageShouldBeOpaque));
-
- // windowSnapshotImage will be in the display's color space, but WKImageCreateFromCGImage() will draw
- // this image into a GenericRGB bitmap context, so the returned image is GenericRGB.
+
+ // windowSnapshotImage will be in GenericRGB, as we've set the main display's color space to GenericRGB.
return adoptWK(WKImageCreateFromCGImage(windowSnapshotImage.get(), 0));
}