Commit 497fbc9b authored by danakj's avatar danakj Committed by Commit Bot

Move GetTestingColorSpace() out of web_test_support_renderer.

This method is used in the renderer and doesn't need the hole punching
to content-internal that web_test_support_renderer was designed for.
Move it to web_test/blink_test_helpers.h.

R=nasko@chromium.org

Bug: 866140
Change-Id: I62f16e813b5eae8aa7b117c992f072b65ebf8be3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2142512Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757526}
parent 83d4961f
......@@ -66,10 +66,6 @@ std::unique_ptr<blink::WebInputEvent> TransformScreenToWidgetCoordinates(
WebWidgetTestProxy* web_widget_test_proxy,
const blink::WebInputEvent& event);
// Get the color space for a given name string. This is not in the ColorSpace
// class to avoid bloating the shipping build.
gfx::ColorSpace GetTestingColorSpace(const std::string& name);
// Set the device color space.
void SetDeviceColorSpace(RenderView* render_view,
const gfx::ColorSpace& color_space);
......
......@@ -194,6 +194,7 @@ static_library("web_test_renderer") {
"//ui/events:events_base",
"//ui/events/blink",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//v8",
]
......
......@@ -17,6 +17,9 @@
#include "content/shell/common/web_test/web_test_switches.h"
#include "content/shell/test_runner/test_preferences.h"
#include "net/base/filename_util.h"
#include "ui/display/display.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/test/icc_profiles.h"
#if defined(OS_MACOSX)
#include "base/mac/bundle_locations.h"
......@@ -141,4 +144,19 @@ WebURL RewriteWebTestsURL(const std::string& utf8_url, bool is_wpt_mode) {
return WebURL(GURL(new_url));
}
gfx::ColorSpace GetWebTestColorSpace(const std::string& name) {
if (name == "genericRGB") {
return gfx::ICCProfileForTestingGenericRGB().GetColorSpace();
} else if (name == "sRGB") {
return gfx::ColorSpace::CreateSRGB();
} else if (name == "test" || name == "colorSpin") {
return gfx::ICCProfileForTestingColorSpin().GetColorSpace();
} else if (name == "adobeRGB") {
return gfx::ICCProfileForTestingAdobeRGB().GetColorSpace();
} else if (name == "reset") {
return display::Display::GetForcedDisplayColorProfile();
}
return gfx::ColorSpace();
}
} // namespace content
......@@ -7,6 +7,12 @@
#include "third_party/blink/public/platform/web_url.h"
#include <string>
namespace gfx {
class ColorSpace;
}
namespace content {
struct TestPreferences;
struct WebPreferences;
......@@ -22,6 +28,10 @@ void ExportWebTestSpecificPreferences(const TestPreferences& from,
// path links in web-platform-tests.
blink::WebURL RewriteWebTestsURL(const std::string& utf8_url, bool is_wpt_mode);
// Get the color space for a given name string. This is not in the ColorSpace
// class to avoid bloating the shipping build.
gfx::ColorSpace GetWebTestColorSpace(const std::string& name);
} // namespace content
#endif // CONTENT_SHELL_RENDERER_WEB_TEST_BLINK_TEST_HELPERS_H_
......@@ -327,7 +327,7 @@ bool BlinkTestRunner::IsUseZoomForDSFEnabled() {
}
void BlinkTestRunner::SetDeviceColorSpace(const std::string& name) {
content::SetDeviceColorSpace(render_view(), GetTestingColorSpace(name));
content::SetDeviceColorSpace(render_view(), GetWebTestColorSpace(name));
}
void BlinkTestRunner::SetBluetoothFakeAdapter(const std::string& adapter_name,
......
......@@ -785,7 +785,6 @@ static_library("web_test_support_renderer") {
"//content/public/renderer",
"//content/renderer:for_content_tests",
"//ui/events/blink",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
# This is required to ensure
......
......@@ -35,7 +35,6 @@
#include "ui/events/blink/blink_event_util.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/icc_profile.h"
#include "ui/gfx/test/icc_profiles.h"
namespace content {
......@@ -172,21 +171,6 @@ std::unique_ptr<blink::WebInputEvent> TransformScreenToWidgetCoordinates(
return ui::TranslateAndScaleWebInputEvent(event, delta, scale);
}
gfx::ColorSpace GetTestingColorSpace(const std::string& name) {
if (name == "genericRGB") {
return gfx::ICCProfileForTestingGenericRGB().GetColorSpace();
} else if (name == "sRGB") {
return gfx::ColorSpace::CreateSRGB();
} else if (name == "test" || name == "colorSpin") {
return gfx::ICCProfileForTestingColorSpin().GetColorSpace();
} else if (name == "adobeRGB") {
return gfx::ICCProfileForTestingAdobeRGB().GetColorSpace();
} else if (name == "reset") {
return display::Display::GetForcedDisplayColorProfile();
}
return gfx::ColorSpace();
}
void SetDeviceColorSpace(RenderView* render_view,
const gfx::ColorSpace& color_space) {
RenderViewImpl* render_view_impl = static_cast<RenderViewImpl*>(render_view);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment