Automation API should include image labeling AXMode

We recently introduced a new AXMode that turns on image
labeling for a WebContents, and it's integrated into
BrowserAccessibilityState, the mechanism used to
set the global AXMode on most platforms.

On Chrome OS the mechanism is slightly different, using
the automation API, and we missed one place. Fix it
by merging the AXMode set for the automation API with
the image labeling flag if needed, and add a test for it.

Bug: 938637, 905419

Change-Id: I273b35e3ef2457207f8a5ff4482cfeae4178027d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1504695
Commit-Queue: Avi Drissman <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: David Tseng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#638618}
diff --git a/ui/accessibility/PRESUBMIT.py b/ui/accessibility/PRESUBMIT.py
index b3038b8..b5bb4259 100644
--- a/ui/accessibility/PRESUBMIT.py
+++ b/ui/accessibility/PRESUBMIT.py
@@ -159,7 +159,11 @@
     # Look for lines of the form "static constexpr <type> NAME "
     m = re.search('static constexpr [\w]+ ([\w]+)', line)
     if m:
-      values.append(m.group(1))
+      value = m.group(1)
+      # Skip first/last sentinels
+      if value == 'kFirstModeFlag' or value == 'kLastModeFlag':
+        continue
+      values.append(value)
 
   return values