blob: de3105190baf271bc19ebe7e4b594a24e1869825 [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2019 The Chromium Authors
Joey Arhar71a7c702020-01-03 01:18:292// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Joey Arharfee2db42020-07-31 21:07:115#include "base/files/file_util.h"
Joey Arhar71a7c702020-01-03 01:18:296#include "base/path_service.h"
kylechar43c1b322025-02-04 14:09:477#include "base/test/scoped_feature_list.h"
Filip Gorskied6f8f3e2020-04-14 03:07:238#include "build/build_config.h"
9#include "cc/test/pixel_comparator.h"
Joey Arharfee2db42020-07-31 21:07:1110#include "content/public/browser/render_widget_host_view.h"
Joey Arhar71a7c702020-01-03 01:18:2911#include "content/public/common/content_paths.h"
Lei Zhang5b0ddd02021-04-01 04:27:5612#include "content/public/common/content_switches.h"
Peter Kasting919ce652020-05-07 10:22:3613#include "content/public/test/browser_test.h"
Joey Arhar71a7c702020-01-03 01:18:2914#include "content/public/test/browser_test_utils.h"
15#include "content/public/test/content_browser_test.h"
16#include "content/public/test/content_browser_test_utils.h"
17#include "content/public/test/test_utils.h"
18#include "content/shell/browser/shell.h"
Colin Blundellbf6aaf72023-11-07 15:06:0119#include "gpu/config/gpu_finch_features.h"
Joey Arhar71a7c702020-01-03 01:18:2920#include "ui/base/ui_base_features.h"
Ionel Popescua8b4adb2021-01-15 01:08:3421#include "ui/base/ui_base_switches.h"
Joey Arhar71a7c702020-01-03 01:18:2922
Xiaohan Wang1ecfd002022-01-19 22:33:1023#if BUILDFLAG(IS_ANDROID)
Andrew Grieve7bd9a4b2025-08-11 21:29:4224#include "base/android/android_info.h"
Joey Arharfee2db42020-07-31 21:07:1125#endif
26
Alison Gale81f4f2c72024-04-22 19:33:3127// TODO(crbug.com/40625383): Move the baselines to skia gold for easier
Joey Arharfee2db42020-07-31 21:07:1128// rebaselining when all platforms are supported.
29
30// To rebaseline this test on all platforms:
31// 1. Run a CQ+1 dry run.
32// 2. Click the failing bots for android, windows, mac, and linux.
Aleks Totic3e3d9472021-06-28 20:50:5933// 3. Find the failing content_browsertests step.
Joey Arharfee2db42020-07-31 21:07:1134// 4. Click the "Deterministic failure" link for the failing test case.
35// 5. Copy the "Actual pixels" data url and paste into browser.
36// 6. Save the image into your chromium checkout in content/test/data/forms/.
Joey Arhar71a7c702020-01-03 01:18:2937
38namespace content {
39
40class FormControlsBrowserTest : public ContentBrowserTest {
41 public:
kylechar43c1b322025-02-04 14:09:4742 FormControlsBrowserTest() {
43#if BUILDFLAG(IS_ANDROID)
44 // TODO(crbug.com/391378106): On Android the graphite results are different
45 // enough to need separate expected images. Force using ganesh until either
46 // all Android bots are running graphite or these tests support skia gold.
47 feature_list_.InitAndDisableFeature(features::kSkiaGraphite);
48#endif
49 }
50
Joey Arhar71a7c702020-01-03 01:18:2951 void SetUp() override {
Joey Arharfee2db42020-07-31 21:07:1152 EnablePixelOutput(/*force_device_scale_factor=*/1.f);
Joey Arhar71a7c702020-01-03 01:18:2953 ContentBrowserTest::SetUp();
54 }
55
56 void SetUpCommandLine(base::CommandLine* command_line) override {
Joey Arharfee2db42020-07-31 21:07:1157 // The --disable-lcd-text flag helps text render more similarly on
58 // different bots and platform.
59 command_line->AppendSwitch(switches::kDisableLCDText);
Ionel Popescua8b4adb2021-01-15 01:08:3460
61 // This is required to allow dark mode to be used on some platforms.
62 command_line->AppendSwitch(switches::kForceDarkMode);
Joey Arhar71a7c702020-01-03 01:18:2963 }
64
Joey Arharfee2db42020-07-31 21:07:1165 void RunTest(const std::string& screenshot_filename,
66 const std::string& body_html,
67 int screenshot_width,
68 int screenshot_height) {
Hitoshi Yoshida53738892020-07-28 03:00:5269 base::ScopedAllowBlockingForTesting allow_blocking;
Joey Arharfee2db42020-07-31 21:07:1170
Joey Arharfee2db42020-07-31 21:07:1171 std::string platform_suffix;
Xiaohan Wang1ecfd002022-01-19 22:33:1072#if BUILDFLAG(IS_MAC)
Joey Arharfee2db42020-07-31 21:07:1173 platform_suffix = "_mac";
Xiaohan Wang1ecfd002022-01-19 22:33:1074#elif BUILDFLAG(IS_WIN)
Joey Arharfee2db42020-07-31 21:07:1175 platform_suffix = "_win";
Xiaohan Wang1ecfd002022-01-19 22:33:1076#elif BUILDFLAG(IS_LINUX)
Peng Huang292a2a182021-09-27 19:43:2377 platform_suffix = "_linux";
Xiaohan Wang1ecfd002022-01-19 22:33:1078#elif BUILDFLAG(IS_CHROMEOS)
Joey Arharfee2db42020-07-31 21:07:1179 platform_suffix = "_chromeos";
Xiaohan Wang1ecfd002022-01-19 22:33:1080#elif BUILDFLAG(IS_ANDROID)
Andrew Grieve7bd9a4b2025-08-11 21:29:4281 int sdk_int = base::android::android_info::sdk_int();
82 if (sdk_int >= base::android::android_info::SDK_VERSION_T) {
Michael Thiessen634dba1b2024-06-27 13:47:2483 platform_suffix = "_android_T";
Joey Arharfee2db42020-07-31 21:07:1184 } else {
85 platform_suffix = "_android";
86 }
Xiaohan Wang1ecfd002022-01-19 22:33:1087#elif BUILDFLAG(IS_FUCHSIA)
Fabrice de Gans749a41c42021-10-18 19:32:0888 platform_suffix = "_fuchsia";
Ian Vollickecc53b772023-06-15 15:47:2489#elif BUILDFLAG(IS_IOS)
90 platform_suffix = "_ios";
Joey Arharfee2db42020-07-31 21:07:1191#endif
Filip Gorskied6f8f3e2020-04-14 03:07:2392
Joey Arhar71a7c702020-01-03 01:18:2993 base::FilePath dir_test_data;
94 ASSERT_TRUE(base::PathService::Get(DIR_TEST_DATA, &dir_test_data));
Joey Arharfee2db42020-07-31 21:07:1195 base::FilePath golden_filepath =
96 dir_test_data.AppendASCII("forms").AppendASCII(screenshot_filename +
97 ".png");
Hitoshi Yoshida53738892020-07-28 03:00:5298
Joey Arharfee2db42020-07-31 21:07:1199 base::FilePath golden_filepath_platform =
100 golden_filepath.InsertBeforeExtensionASCII(platform_suffix);
101 if (base::PathExists(golden_filepath_platform)) {
102 golden_filepath = golden_filepath_platform;
103 }
104
Ionel Popescua8b4adb2021-01-15 01:08:34105 ASSERT_TRUE(
106 NavigateToURL(shell()->web_contents(),
107 GURL("data:text/html,<!DOCTYPE html>" + body_html)));
Joey Arharfee2db42020-07-31 21:07:11108
Ian Vollickecc53b772023-06-15 15:47:24109#if BUILDFLAG(IS_APPLE)
Joey Arharfee2db42020-07-31 21:07:11110 // This fuzzy pixel comparator handles several mac behaviors:
111 // - Different font rendering after 10.14
Joey Arharfee2db42020-07-31 21:07:11112 // - Slight differences in radio and checkbox rendering in 10.15
Xianzhu Wang43fe4442023-01-24 23:59:09113 // TODO(wangxianzhu): Tighten these parameters.
114 auto comparator = cc::FuzzyPixelComparator()
115 .DiscardAlpha()
Alex Ilin4b0deea2023-01-30 16:56:00116 .SetErrorPixelsPercentageLimit(26.f)
Xianzhu Wang43fe4442023-01-24 23:59:09117 .SetAvgAbsErrorLimit(20.f)
Alex Ilin4b0deea2023-01-30 16:56:00118 .SetAbsErrorLimit(120);
Xiaohan Wang1ecfd002022-01-19 22:33:10119#elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || (OS_LINUX) || \
120 BUILDFLAG(IS_FUCHSIA)
Joey Arharfee2db42020-07-31 21:07:11121 // Different versions of android may have slight differences in rendering.
122 // Some versions have more significant differences than others, which are
123 // tracked separately in separate baseline image files. The less significant
124 // differences are accommodated for with this fuzzy pixel comparator.
Xianzhu Wang43fe4442023-01-24 23:59:09125 // This also applies to different versions of other OSes.
126 auto comparator = cc::FuzzyPixelComparator()
127 .DiscardAlpha()
Alex Ilin4b0deea2023-01-30 16:56:00128 .SetErrorPixelsPercentageLimit(11.f)
Michael Ludwig64abcf42025-08-05 10:37:15129 .SetAvgAbsErrorLimit(12.f)
Alex Ilin4b0deea2023-01-30 16:56:00130 .SetAbsErrorLimit(140);
Hitoshi Yoshida53738892020-07-28 03:00:52131#else
Xianzhu Wang43fe4442023-01-24 23:59:09132 cc::AlphaDiscardingExactPixelComparator comparator;
Hitoshi Yoshida53738892020-07-28 03:00:52133#endif
Joey Arharfee2db42020-07-31 21:07:11134 EXPECT_TRUE(CompareWebContentsOutputToReference(
135 shell()->web_contents(), golden_filepath,
136 gfx::Size(screenshot_width, screenshot_height), comparator));
Joey Arhar71a7c702020-01-03 01:18:29137 }
138
Yu Han26a105a2021-02-09 22:05:32139 // Check if the test can run on the current system.
Yu Han87d8dc82021-02-11 08:15:44140 bool SkipTestForOldAndroidVersions() const {
Xiaohan Wang1ecfd002022-01-19 22:33:10141#if BUILDFLAG(IS_ANDROID)
Yu Han26a105a2021-02-09 22:05:32142 // Lower versions of android running on older devices, ex Nexus 5, render
143 // form controls with a too large of a difference -- >20% error -- to
144 // pixel compare.
Andrew Grieve7bd9a4b2025-08-11 21:29:42145 if (base::android::android_info::sdk_int() <
146 base::android::android_info::SDK_VERSION_OREO) {
Yu Han87d8dc82021-02-11 08:15:44147 return true;
Yu Han26a105a2021-02-09 22:05:32148 }
Xiaohan Wang1ecfd002022-01-19 22:33:10149#endif // BUILDFLAG(IS_ANDROID)
Yu Han87d8dc82021-02-11 08:15:44150 return false;
Yu Han26a105a2021-02-09 22:05:32151 }
kylechar43c1b322025-02-04 14:09:47152
153 base::test::ScopedFeatureList feature_list_;
Joey Arhar71a7c702020-01-03 01:18:29154};
155
Aleks Totic55ee62c42021-08-19 22:50:28156// Checkbox renders differently on Android x86. crbug.com/1238283
Christoph Schwering046f1e332025-03-14 19:26:55157// TODO(crbug.com/401594933): The test fails on Windows ARM64.
158#if (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_X86)) || \
159 (BUILDFLAG(IS_WIN) && defined(ARCH_CPU_ARM64))
Aleks Totic55ee62c42021-08-19 22:50:28160#define MAYBE_Checkbox DISABLED_Checkbox
161#else
162#define MAYBE_Checkbox Checkbox
163#endif
Aleks Totic55ee62c42021-08-19 22:50:28164IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, MAYBE_Checkbox) {
Alex Ilin4b0deea2023-01-30 16:56:00165 if (SkipTestForOldAndroidVersions())
166 return;
Yu Han26a105a2021-02-09 22:05:32167
Joey Arharfee2db42020-07-31 21:07:11168 RunTest("form_controls_browsertest_checkbox",
169 "<input type=checkbox>"
170 "<input type=checkbox checked>"
171 "<input type=checkbox disabled>"
172 "<input type=checkbox checked disabled>"
173 "<input type=checkbox id=\"indeterminate\">"
174 "<script>"
175 " document.getElementById('indeterminate').indeterminate = true"
176 "</script>",
177 /* screenshot_width */ 130,
178 /* screenshot_height */ 40);
Joey Arhar71a7c702020-01-03 01:18:29179}
180
Yu Han26a105a2021-02-09 22:05:32181IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Radio) {
Alex Ilin4b0deea2023-01-30 16:56:00182 if (SkipTestForOldAndroidVersions())
183 return;
Yu Han26a105a2021-02-09 22:05:32184
Joey Arharfee2db42020-07-31 21:07:11185 RunTest("form_controls_browsertest_radio",
186 "<input type=radio>"
187 "<input type=radio checked>"
188 "<input type=radio disabled>"
189 "<input type=radio checked disabled>"
190 "<input type=radio id=\"indeterminate\">"
191 "<script>"
192 " document.getElementById('indeterminate').indeterminate = true"
193 "</script>",
194 /* screenshot_width */ 140,
195 /* screenshot_height */ 40);
Joey Arhar71a7c702020-01-03 01:18:29196}
197
Kaylee Lubickb2616d0d2025-03-10 15:10:51198#if BUILDFLAG(IS_MAC)
Joey Arharb5660eb2023-05-13 00:23:54199#define MAYBE_DarkModeTextSelection DISABLED_DarkModeTextSelection
200#else
201#define MAYBE_DarkModeTextSelection DarkModeTextSelection
202#endif
203IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, MAYBE_DarkModeTextSelection) {
Alex Ilin4b0deea2023-01-30 16:56:00204 if (SkipTestForOldAndroidVersions())
205 return;
Yu Hanc107b262021-03-01 08:13:54206
Ionel Popescua8b4adb2021-01-15 01:08:34207 RunTest("form_controls_browsertest_dark_mode_text_selection",
208 "<meta name=\"color-scheme\" content=\"dark\">"
209 "<div id=\"target\">This is some basic text that we are going to "
210 "select.</div>"
211 "<script>"
212 " let container = document.getElementById('target');"
213 " container.focus();"
214 " let targetText = container.firstChild;"
215 " let selectionRange = window.getSelection();"
216 " selectionRange.setBaseAndExtent(targetText, 5, targetText, 35);"
217 "</script>",
218 /* screenshot_width */ 400,
219 /* screenshot_height */ 40);
220}
221
Yu Hanc107b262021-03-01 08:13:54222IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Input) {
Alex Ilin4b0deea2023-01-30 16:56:00223 if (SkipTestForOldAndroidVersions())
224 return;
Yu Hanc107b262021-03-01 08:13:54225
Yu Hanff3eeb2b2021-01-27 18:09:25226 RunTest("form_controls_browsertest_input",
Yu Hanff3eeb2b2021-01-27 18:09:25227 "<style>body {margin: 8px} input {width: 150px; "
228 "margin-bottom: 18px}</style>"
229 "<input type=\"text\" /><br>"
230 "<input type=\"number\" /><br>"
231 "<input type=\"search\" /><br>"
232 "<input type=\"email\" /><br>"
233 "<input type=\"password\" /><br>"
234 "<!-- border -->"
235 "<input type=\"text\" style=\"border: 3px solid lime;\"/><br>"
236 "<!-- shadow -->"
237 "<input type=\"text\" style=\"box-shadow: 4px 4px 10px "
238 "rgba(255,0,0,0.5), inset 4px 4px 4px rgba(0,255,0,0.5);\"/><br>"
239 "<!-- disabled -->"
240 "<input type=\"text\" disabled/>",
241 /* screenshot_width */ 200,
242 /* screenshot_height */ 330);
243}
244
Christoph Schwering046f1e332025-03-14 19:26:55245// The test fails on Windows ARM64: crbug.com/401594933.
246#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || \
247 (BUILDFLAG(IS_WIN) && defined(ARCH_CPU_ARM64))
Michael Wilson276c00c2024-02-13 18:35:17248#define MAYBE_Textarea DISABLED_Textarea
249#else
250#define MAYBE_Textarea Textarea
251#endif
252IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, MAYBE_Textarea) {
Alex Ilin4b0deea2023-01-30 16:56:00253 if (SkipTestForOldAndroidVersions())
254 return;
Yu Hanc107b262021-03-01 08:13:54255
256 RunTest("form_controls_browsertest_textarea",
257 R"HTML(
258 <style>
259 body {margin: 8px} textarea {width: 150px; margin-bottom: 18px}
260 </style>
261 <textarea></textarea><br>
262 <textarea style="border: 3px solid lime"></textarea><br>
263 <!-- shadow -->
264 <textarea style="box-shadow: 4px 4px 10px rgba(255,0,0,0.5),
265 inset 4px 4px 4px rgba(0,255,0,0.5);"></textarea><br>
266 <!-- disabled -->
267 <textarea disabled></textarea>)HTML",
268 /* screenshot_width */ 200,
269 /* screenshot_height */ 260);
270}
271
272IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Button) {
Alex Ilin4b0deea2023-01-30 16:56:00273 if (SkipTestForOldAndroidVersions())
274 return;
Yu Hanc107b262021-03-01 08:13:54275
Yu Hanc107b262021-03-01 08:13:54276 RunTest("form_controls_browsertest_button",
277 R"HTML(
278 <style>body {margin: 8px} input {margin-bottom: 18px;}</style>
279 <input type="button" value="button"/><br>
280 <input type="submit" /><br>
281 <input type="reset" /><br>
282 <input type="file" /><br>
283 <!-- border -->
284 <input type="button" value="button"
285 style="border: 3px solid lime;"/><br>
286 <!-- shadow -->
287 <input type="button" value="button"
288 style="box-shadow: 4px 4px 10px
289 rgba(255,0,0,0.5), inset 4px 4px 4px rgba(0,255,0,0.5);"/><br>
290 <!-- disabled -->
291 <input type="button" value="button" disabled/>)HTML",
292 /* screenshot_width */ 200,
293 /* screenshot_height */ 300);
294}
295
Yu Han9dee5502021-03-05 21:25:58296// TODO(crbug.com/1160104/#25) This test creates large average_error_rate on
297// Android FYI SkiaRenderer Vulkan. Disable it until a resolution for is
298// found.
Christoph Schwering046f1e332025-03-14 19:26:55299// TODO(crbug.com/401594933): The test fails on Windows ARM64.
David Baron21a012a2025-06-25 13:31:46300#if BUILDFLAG(IS_ANDROID) || (BUILDFLAG(IS_WIN) && defined(ARCH_CPU_ARM64))
Yu Han9dee5502021-03-05 21:25:58301#define MAYBE_ColorInput DISABLED_ColorInput
302#else
303#define MAYBE_ColorInput ColorInput
304#endif
305IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, MAYBE_ColorInput) {
Alex Ilin4b0deea2023-01-30 16:56:00306 if (SkipTestForOldAndroidVersions())
307 return;
Yu Hanc107b262021-03-01 08:13:54308
309 RunTest("form_controls_browsertest_color_input",
310 R"HTML(
311 <style>body {margin: 8px} input {margin-bottom: 18px;}</style>
312 <input type="color" /><br>
313 <input type="color" value='%2300ff00' /><br>
314 <input type="color" list /><br>
315 <!-- border -->
316 <input type="color" value="%2300ff00"
317 style="border: 3px solid lime;"/><br>
318 <!-- disabled -->
319 <input type="color" disabled/>)HTML",
320 /* screenshot_width */ 200,
321 /* screenshot_height */ 250);
322}
323
Christoph Schwering046f1e332025-03-14 19:26:55324// TODO(crbug.com/401594933): The test fails on Windows ARM64.
325#if BUILDFLAG(IS_WIN) && defined(ARCH_CPU_ARM64)
326#define MAYBE_Select DISABLED_Select
327#else
328#define MAYBE_Select DISABLED_Select
329#endif
330IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, MAYBE_Select) {
Alex Ilin4b0deea2023-01-30 16:56:00331 if (SkipTestForOldAndroidVersions())
332 return;
Yu Hanc107b262021-03-01 08:13:54333
334 RunTest("form_controls_browsertest_select",
335 R"HTML(
336 <style>
337 body {margin: 8px}
338 select {margin-bottom: 18px; width: 170px;}
339 </style>
340 <select></select><br>
341 <select style="color:darkturquoise"></select><br>
342 <!-- border -->
343 <select style="border: 3px solid lime;"></select><br>
344 <!-- shadow -->
345 <select style="box-shadow: 4px 4px 10px rgba(255,0,0,0.5),
346 inset 4px 4px 4px rgba(0,255,0,0.5);"></select><br>
347 <!-- disabled -->
348 <select disabled></select><br>)HTML",
349 /* screenshot_width */ 200,
350 /* screenshot_height */ 200);
351}
352
Gastón Rodríguez947c417412025-02-21 16:46:29353// TODO(crbug.com/377986468) : Flaky on Windows. Seems to lose focus of top
354// <select> in some runs which causes the results to be different from
355// expectations.
Vidhan Jaind46b1ed12025-05-15 13:08:29356#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS)
Lei Zhang0cc6ac42024-11-15 21:40:27357#define MAYBE_MultiSelect DISABLED_MultiSelect
358#else
359#define MAYBE_MultiSelect MultiSelect
360#endif
361IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, MAYBE_MultiSelect) {
Alex Ilin4b0deea2023-01-30 16:56:00362 if (SkipTestForOldAndroidVersions())
363 return;
Yu Hanc107b262021-03-01 08:13:54364
365 RunTest("form_controls_browsertest_multi_select",
366 R"HTML(
367 <style>
368 body {margin: 8px}
369 select {margin-bottom: 18px; width: 170px; }
370 </style>
371 <select multiple autofocus size=5>
372 <optgroup label="unstyled select"></optgroup>
373 </select> <br>
374 <!-- border -->
375 <select multiple style="border: 3px solid lime;" size=5>
376 <optgroup label="thick lime border"></optgroup>
377 </select><br>
378 <!-- disabled -->
379 <select multiple disabled size=5>
380 <optgroup label="disabled select">
381 </optgroup>
382 </select>)HTML",
383 /* screenshot_width */ 200,
384 /* screenshot_height */ 330);
385}
386
387IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Progress) {
Alex Ilin4b0deea2023-01-30 16:56:00388 if (SkipTestForOldAndroidVersions())
389 return;
Yu Hanc107b262021-03-01 08:13:54390
Colin Blundell825adeba2023-11-08 12:39:38391#if BUILDFLAG(IS_MAC) && !defined(ARCH_CPU_ARM64)
Colin Blundellbf6aaf72023-11-07 15:06:01392 // The pixel comparison fails on Mac Intel GPUs with Graphite due to MSAA
393 // issues.
Alison Gale81f4f2c72024-04-22 19:33:31394 // TODO(crbug.com/40940637): Re-enable test if possible.
Colin Blundellbf6aaf72023-11-07 15:06:01395 if (features::IsSkiaGraphiteEnabled(base::CommandLine::ForCurrentProcess())) {
396 return;
397 }
398#endif
399
Yu Hanc107b262021-03-01 08:13:54400 RunTest("form_controls_browsertest_progress",
401 R"HTML(
402 <style>
403 body {margin: 8px} progress {margin-bottom: 18px}
404 </style>
405 <progress max="100" value="0"></progress><br>
406 <progress max="100" value="5"></progress><br>
407 <progress max="100" value="25"></progress><br><br>
408 <progress max="100" value="50"></progress><br><br>
409 <progress max="100" value="100"></progress><br><br>
410 <progress max="100" value="50" style="height:30px"></progress>
411 )HTML",
412 /* screenshot_width */ 200,
413 /* screenshot_height */ 300);
414}
415
416IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Meter) {
Alex Ilin4b0deea2023-01-30 16:56:00417 if (SkipTestForOldAndroidVersions())
418 return;
Yu Hanc107b262021-03-01 08:13:54419
420 RunTest("form_controls_browsertest_meter",
421 R"HTML(
422 <style>
423 body {margin: 8px} meter {margin-bottom: 10px}
424 </style>
425 <meter min="0" max="100" low="33" high="66" optimum="100"
426 value="20"></meter><br>
427 <meter min="0" max="100" low="33" high="66" optimum="100"
428 value="50"></meter><br>
429 <meter min="0" max="100" low="33" high="66" optimum="100"
430 value="66"></meter><br>
431 <meter min="0" max="100" low="33" high="66" optimum="100"
432 value="90"></meter><br>
433 <!-- border -->
434 <meter style="border-color: %23000000; border-style: solid;
435 border-width: 5px;" min="0" max="100" low="30" high="60"
436 optimum="100" value="80" ></meter><br>
437 <meter style="box-shadow: 4px 4px 10px rgba(255,0,0,0.5),
438 inset 4px 4px 4px rgba(0,255,0,0.5);"></meter>)HTML",
439 /* screenshot_width */ 150,
440 /* screenshot_height */ 200);
441}
442
443IN_PROC_BROWSER_TEST_F(FormControlsBrowserTest, Range) {
Alex Ilin4b0deea2023-01-30 16:56:00444 if (SkipTestForOldAndroidVersions())
445 return;
Yu Hanc107b262021-03-01 08:13:54446
447 RunTest("form_controls_browsertest_range",
448 R"HTML(
449 <style>
450 body {margin: 8px} input {margin-bottom: 18px}
451 </style>
452 <input type="range"><br>
453 )HTML",
454 /* screenshot_width */ 150,
455 /* screenshot_height */ 150);
456}
457
Joey Arhar71a7c702020-01-03 01:18:29458// TODO(jarhar): Add tests for other elements from
459// https://concrete-hardboard.glitch.me
460
461} // namespace content