Add Low Latency desynchronized hint to canvas 2d

To make Chrome treat the canvas as an overlay candidate, enable low
latency rendering with the desynchronized hint.
Rename the test to reflect the low latency condition.

BUG=942655
TEST=graphics_HwOverlays.canvas2D

Change-Id: Ie90462879bd02ae154200c5279779cc9dcb90d99
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1966111
Tested-by: Mark Yacoub <markyacoub@google.com>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Miguel Casas <mcasas@chromium.org>
Reviewed-by: Mark Yacoub <markyacoub@google.com>
Auto-Submit: Mark Yacoub <markyacoub@google.com>
diff --git a/client/site_tests/graphics_HwOverlays/canvas_2d.html b/client/site_tests/graphics_HwOverlays/canvas_2d_low_latency.html
similarity index 83%
rename from client/site_tests/graphics_HwOverlays/canvas_2d.html
rename to client/site_tests/graphics_HwOverlays/canvas_2d_low_latency.html
index 04e099c..956ff21 100644
--- a/client/site_tests/graphics_HwOverlays/canvas_2d.html
+++ b/client/site_tests/graphics_HwOverlays/canvas_2d_low_latency.html
@@ -1,12 +1,12 @@
 <html>
 <head>
-  <title>Canvas 2D</title>
+  <title>Canvas 2D Low Latency</title>
 </head>
 <body>
   <canvas id='canvas1' style="border: 1px solid black;"></canvas>
 </body>
 <script type="text/javascript">
-  var canvas = document.getElementById('canvas1');
+  let canvas = document.getElementById('canvas1');
   // Make the canvas very large but still falling inside the viewport; |height|
   // also has to account for the Shelf (taskbar) at the bottom.
   const dpr = window.devicePixelRatio || 1;
@@ -15,8 +15,11 @@
   canvas.width = width;
   canvas.height = height;
 
-  var ctx = canvas.getContext('2d');
-  var draw_passes_count = 0;
+  let ctx = canvas.getContext('2d', {
+    desynchronized: true,
+    alpha: false
+  });
+  let draw_passes_count = 0;
 
   function draw_pass() {
     ctx.beginPath();
diff --git a/client/site_tests/graphics_HwOverlays/control.canvas2D b/client/site_tests/graphics_HwOverlays/control.canvas2D
deleted file mode 100644
index 9a95ffc..0000000
--- a/client/site_tests/graphics_HwOverlays/control.canvas2D
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-AUTHOR = "chromeos-gfx"
-NAME = "graphics_HwOverlays.canvas2D"
-TIME = "SHORT"
-TEST_CATEGORY = "Functional"
-TEST_CLASS = "graphics"
-TEST_TYPE = "client"
-
-ATTRIBUTES = "suite:bvt-perbuild"
-
-HTML_TEST_FILE = 'canvas_2d.html'
-
-DOC = """
-Runs a very simple HTML canvas 2D test (creating the context and drawing a few
-strokes) and inspects the amount of hardware overlays reported by the system.
-"""
-
-job.run_test('graphics_HwOverlays', html_file=HTML_TEST_FILE)
diff --git a/client/site_tests/graphics_HwOverlays/control.canvas2DLowLatency b/client/site_tests/graphics_HwOverlays/control.canvas2DLowLatency
new file mode 100644
index 0000000..5e8399a
--- /dev/null
+++ b/client/site_tests/graphics_HwOverlays/control.canvas2DLowLatency
@@ -0,0 +1,22 @@
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = "chromeos-gfx"
+NAME = "graphics_HwOverlays.canvas2DLowLatency"
+TIME = "SHORT"
+TEST_CATEGORY = "Functional"
+TEST_CLASS = "graphics"
+TEST_TYPE = "client"
+
+ATTRIBUTES = "suite:bvt-perbuild"
+
+HTML_TEST_FILE = 'canvas_2d_low_latency.html'
+
+DOC = """
+Runs a very simple HTML canvas 2D test with low latency (creating the context
+and drawing a few strokes) and inspects the amount of hardware overlays
+reported by the system.
+"""
+
+job.run_test('graphics_HwOverlays', html_file=HTML_TEST_FILE)