Add Dark Mode web tests for inverting pages based on background color.

Bug: 925949
Change-Id: Ie6042612b107874f984a0ae03794ec235b3e6cc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1510114
Commit-Queue: Aran Gilman <gilmanmh@google.com>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642044}
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites
index 8963d3e..4ba8ae8 100644
--- a/third_party/blink/web_tests/VirtualTestSuites
+++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -470,6 +470,16 @@
     "args": ["--blink-settings=darkMode=3,darkModeImagePolicy=2"]
   },
   {
+    "prefix": "dark-mode",
+    "base": "paint/dark-mode/page-policy-all",
+    "args": ["--blink-settings=darkMode=3,darkModePagePolicy=0"]
+  },
+  {
+    "prefix": "dark-mode",
+    "base": "paint/dark-mode/page-policy-background",
+    "args": ["--blink-settings=darkMode=3,darkModePagePolicy=1"]
+  },
+  {
     "prefix": "outofblink-cors",
     "base": "external/wpt/fetch",
     "args": ["--enable-features=OutOfBlinkCors,NetworkService"]
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-dark-color-expected.png b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-dark-color-expected.png
new file mode 100644
index 0000000..61855f9
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-dark-color-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-dark-color.html b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-dark-color.html
new file mode 100644
index 0000000..9359f11
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-dark-color.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<body style="background-color: #000080"></body>
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-light-color-expected.png b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-light-color-expected.png
new file mode 100644
index 0000000..d03c47e
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-light-color-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-light-color.html b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-light-color.html
new file mode 100644
index 0000000..fe10c89
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-all/background-light-color.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<body style="background-color: #8080ff"></body>
+
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-invert-expected.png b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-invert-expected.png
new file mode 100644
index 0000000..d03c47e
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-invert-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-invert.html b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-invert.html
new file mode 100644
index 0000000..fe10c89
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-invert.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<body style="background-color: #8080ff"></body>
+
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-noinvert-expected.png b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-noinvert-expected.png
new file mode 100644
index 0000000..61855f9
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-noinvert-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-noinvert.html b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-noinvert.html
new file mode 100644
index 0000000..9359f11
--- /dev/null
+++ b/third_party/blink/web_tests/paint/dark-mode/page-policy-background/background-noinvert.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<body style="background-color: #000080"></body>
diff --git a/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/README.txt b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/README.txt
new file mode 100644
index 0000000..5d548a8
--- /dev/null
+++ b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/README.txt
@@ -0,0 +1,3 @@
+# This suite runs the tests in LayoutTests/paint/dark-mode
+# with --blink-settings="highContrastMode=3,darkModePagePolicy=0"
+# See the virtual_test_suites() method in tools/blinkpy/web_tests/port/base.py.
diff --git a/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/background-dark-color-expected.png b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/background-dark-color-expected.png
new file mode 100644
index 0000000..cbf6c45
--- /dev/null
+++ b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/background-dark-color-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/background-light-color-expected.png b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/background-light-color-expected.png
new file mode 100644
index 0000000..fa4f72b
--- /dev/null
+++ b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-all/background-light-color-expected.png
Binary files differ
diff --git a/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-background/README.txt b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-background/README.txt
new file mode 100644
index 0000000..156dcb7
--- /dev/null
+++ b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-background/README.txt
@@ -0,0 +1,3 @@
+# This suite runs the tests in LayoutTests/paint/dark-mode
+# with --blink-settings="highContrastMode=3,darkModePagePolicy=1"
+# See the virtual_test_suites() method in tools/blinkpy/web_tests/port/base.py.
diff --git a/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-background/background-invert-expected.png b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-background/background-invert-expected.png
new file mode 100644
index 0000000..fa4f72b
--- /dev/null
+++ b/third_party/blink/web_tests/virtual/dark-mode/paint/dark-mode/page-policy-background/background-invert-expected.png
Binary files differ