Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(356)

Unified Diff: content/test/gpu/gpu_tests/color_profile_manager.py

Issue 2944733002: Force sRGB color profile on Mac for pixel tests (Closed)
Patch Set: All platforms 3rd try Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/color_profile_manager_mac.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/gpu/gpu_tests/color_profile_manager.py
diff --git a/content/test/gpu/gpu_tests/color_profile_manager.py b/content/test/gpu/gpu_tests/color_profile_manager.py
new file mode 100644
index 0000000000000000000000000000000000000000..a77f74e1b108cdf60c17d34f12509ce4d85559e3
--- /dev/null
+++ b/content/test/gpu/gpu_tests/color_profile_manager.py
@@ -0,0 +1,32 @@
+# Copyright 2017 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import atexit
+import sys
+
+has_forced_srgb = False
+
+# Force all displays to use an sRGB color profile until atexit.
+def ForceUntilExitSRGB():
+ global has_forced_srgb
+ if not sys.platform.startswith('darwin'):
+ return
+ if has_forced_srgb:
+ return
+ has_forced_srgb = True
+
+ from gpu_tests import color_profile_manager_mac
+ # Record the current color profiles.
+ display_profile_url_map = \
+ color_profile_manager_mac.GetDisplaysToProfileURLMap()
+ # Force to sRGB.
+ for display_id in display_profile_url_map:
+ color_profile_manager_mac.SetDisplayCustomProfile(
+ display_id, color_profile_manager_mac.GetSRGBProfileURL())
+ # Register an atexit handler to restore the previous color profiles.
+ def Restore():
+ for display_id in display_profile_url_map:
+ color_profile_manager_mac.SetDisplayCustomProfile(
+ display_id, display_profile_url_map[display_id])
+ atexit.register(Restore)
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/color_profile_manager_mac.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698