[M120 Migration] Enable input picker for chrome
[platform/framework/web/chromium-efl.git] / content / child / webthemeengine_impl_default_browsertest.cc
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "build/build_config.h"
6 #include "content/public/test/browser_test.h"
7 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h"
9
10 #if BUILDFLAG(IS_WIN)
11 #include "base/win/windows_version.h"
12 #endif
13
14 namespace content {
15
16 class WebThemeEngineImplDefaultBrowserTest : public ContentBrowserTest {
17  public:
18   WebThemeEngineImplDefaultBrowserTest() = default;
19 };
20
21 #if BUILDFLAG(IS_WIN)
22 IN_PROC_BROWSER_TEST_F(WebThemeEngineImplDefaultBrowserTest, GetSystemColor) {
23   // The test non-deterministically fails on Windows-2008ServerR2 builders due
24   // to a difference in the default theme. As a result, only run the test on
25   // non-server versions.
26   // TODO(https://crbug.com/1385856): Remove this, and the windows_version.h
27   // include, if the failure turns out to be specific to Windows-2008ServerR2
28   // and not any Windows server.
29   if (base::win::OSInfo::GetInstance()->version_type() ==
30       base::win::VersionType::SUITE_SERVER) {
31     return;
32   }
33   GURL url(
34       "data:text/html,"
35       "<!doctype html><html>"
36       "<body>"
37       "<div id='activeBorder' style='color: ActiveBorder'>ActiveBorder</div>"
38       "<div id='activeCaption' style='color: ActiveCaption'>ActiveCaption</div>"
39       "<div id='activeText' style='color: ActiveText'>ActiveText</div>"
40       "<div id='appWorkspace' style='color: AppWorkspace'>AppWorkspace</div>"
41       "<div id='background' style='color: Background'>Background</div>"
42       "<div id='buttonFace' style='color: ButtonFace'>ButtonFace</div>"
43       "<div id='buttonHighlight' style='color: "
44       "ButtonHighlight'>ButtonHighlight</div>"
45       "<div id='buttonShadow' style='color: ButtonShadow'>ButtonShadow</div>"
46       "<div id='buttonText' style='color: ButtonText'>ButtonText</div>"
47       "<div id='canvas' style='color: Canvas'>Canvas</div>"
48       "<div id='canvasText' style='color: CanvasText'>CanvasText</div>"
49       "<div id='captionText' style='color: CaptionText'>CaptionText</div>"
50       "<div id='field' style='color: Field'>Field</div>"
51       "<div id='fieldText' style='color: FieldText'>FieldText</div>"
52       "<div id='grayText' style='color: GrayText'>GrayText</div>"
53       "<div id='highlight' style='color: Highlight'>Highlight</div>"
54       "<div id='highlightText' style='color: HighlightText'>HighlightText</div>"
55       "<div id='inactiveBorder' style='color: "
56       "InactiveBorder'>InactiveBorder</div>"
57       "<div id='inactiveCaption' style='color: "
58       "InactiveCaption'>InactiveCaption</div>"
59       "<div id='inactiveCaptionText' style='color: "
60       "InactiveCaptionText'>InactiveCaptionText</div>"
61       "<div id='infoBackground' style='color: "
62       "InfoBackground'>InfoBackground</div>"
63       "<div id='infoText' style='color: InfoText'>InfoText</div>"
64       "<div id='linkText' style='color: LinkText'>LinkText</div>"
65       "<div id='menu' style='color: Menu'>Menu</div>"
66       "<div id='menuText' style='color: MenuText'>MenuText</div>"
67       "<div id='scrollbar' style='color: Scrollbar'>Scrollbar</div>"
68       "<div id='threeDDarkShadow' style='color: "
69       "ThreeDDarkShadow'>ThreeDDarkShadow</div>"
70       "<div id='threeDFace' style='color: ThreeDFace'>ThreeDFace</div>"
71       "<div id='threeDHighlight' style='color: "
72       "ThreeDHighlight'>ThreeDHighlight</div>"
73       "<div id='threeDLightShadow' style='color: "
74       "ThreeDLightShadow'>ThreeDLightShadow</div>"
75       "<div id='threeDShadow' style='color: ThreeDShadow'>ThreeDShadow</div>"
76       "<div id='visitedText' style='color: VisitedText'>VisitedText</div>"
77       "<div id='window' style='color: Window'>Window</div>"
78       "<div id='windowFrame' style='color: WindowFrame'>WindowFrame</div>"
79       "<div id='windowText' style='color: WindowText'>WindowText</div>"
80       "</body></html>");
81   EXPECT_TRUE(NavigateToURL(shell(), url));
82
83   std::vector<std::string> ids = {"activeBorder",
84                                   "activeCaption",
85                                   "activeText",
86                                   "appWorkspace",
87                                   "background",
88                                   "buttonFace",
89                                   "buttonHighlight",
90                                   "buttonShadow",
91                                   "buttonText",
92                                   "canvas",
93                                   "canvasText",
94                                   "captionText",
95                                   "field",
96                                   "fieldText",
97                                   "grayText",
98                                   "highlight",
99                                   "highlightText",
100                                   "inactiveBorder",
101                                   "inactiveCaption",
102                                   "inactiveCaptionText",
103                                   "infoBackground",
104                                   "infoText",
105                                   "linkText",
106                                   "menu",
107                                   "menuText",
108                                   "scrollbar",
109                                   "threeDDarkShadow",
110                                   "threeDFace",
111                                   "threeDHighlight",
112                                   "threeDLightShadow",
113                                   "threeDShadow",
114                                   "visitedText",
115                                   "window",
116                                   "windowFrame",
117                                   "windowText"};
118   const std::vector<std::string> expected_colors = {
119       "rgb(0, 0, 0)",       "rgb(0, 0, 0)",       "rgb(0, 102, 204)",
120       "rgb(255, 255, 255)", "rgb(255, 255, 255)", "rgb(240, 240, 240)",
121       "rgb(240, 240, 240)", "rgb(240, 240, 240)", "rgb(0, 0, 0)",
122       "rgb(255, 255, 255)", "rgb(0, 0, 0)",       "rgb(0, 0, 0)",
123       "rgb(255, 255, 255)", "rgb(0, 0, 0)",       "rgb(109, 109, 109)",
124       "rgb(0, 120, 215)",   "rgb(255, 255, 255)", "rgb(0, 0, 0)",
125       "rgb(255, 255, 255)", "rgb(128, 128, 128)", "rgb(255, 255, 255)",
126       "rgb(0, 0, 0)",       "rgb(0, 102, 204)",   "rgb(255, 255, 255)",
127       "rgb(0, 0, 0)",       "rgb(255, 255, 255)", "rgb(0, 0, 0)",
128       "rgb(240, 240, 240)", "rgb(0, 0, 0)",       "rgb(0, 0, 0)",
129       "rgb(0, 0, 0)",       "rgb(0, 102, 204)",   "rgb(255, 255, 255)",
130       "rgb(0, 0, 0)",       "rgb(0, 0, 0)"};
131
132   ASSERT_EQ(ids.size(), expected_colors.size());
133
134   for (size_t i = 0; i < ids.size(); i++) {
135     EXPECT_EQ(expected_colors[i],
136               EvalJs(shell(),
137                      "window.getComputedStyle(document.getElementById('" +
138                          ids[i] + "')).getPropertyValue('color').toString()"));
139   }
140 }
141 #endif  // BUILDFLAG(IS_WIN)
142
143 }  // namespace content