FontAccess: ChromeOS and Linux platform implementation

This change implements font enumeration for ChromeOS and Linux platforms.
Both platforms make use of fontconfig for enumeration.

Font Data Access is already supported by a previous change adding
@font-face src local matching.

Bug: 1043306
Change-Id: I4a04f94e488e481d2d444469b225178f44f907fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2388103
Commit-Queue: Olivier Yiptong <oyiptong@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803715}
diff --git a/font-access/resources/test-expectations.js b/font-access/resources/test-expectations.js
index 2b35507..6baaeb8 100644
--- a/font-access/resources/test-expectations.js
+++ b/font-access/resources/test-expectations.js
@@ -228,6 +228,23 @@
   },
 ];
 
+const LINUX_FONTS = [
+  {
+    postscriptName: 'Ahem',
+    fullName: 'Ahem',
+    family: 'Ahem',
+    label: TEST_SIZE_CATEGORY.small,
+    expectedTables: [
+      // Tables related to TrueType.
+      'cvt ',
+      'glyf',
+      'loca',
+      'prep',
+      'gasp',
+    ],
+  },
+];
+
 // The OpenType spec mentions that the follow tables are required for a font to
 // function correctly. We'll have all the tables listed except for OS/2, which
 // is not present in all fonts on Mac OS.
@@ -266,6 +283,9 @@
     output = MAC_FONTS;
   } else if (platform === 'win') {
     output = WIN_FONTS;
+  } else if (platform === 'linux') {
+    // Also includes ChromeOS, on which navigator.platform starts with 'Linux'.
+    output = LINUX_FONTS;
   }
 
   if (options.labelFilter.length && output.length) {
@@ -429,7 +449,9 @@
 }
 
 function isPlatformSupported() {
-  if (navigator.platform.indexOf('Mac') != -1 || navigator.platform.indexOf('Win') != -1) {
+  if (navigator.platform.indexOf('Mac') != -1 ||
+      navigator.platform.indexOf('Win') != -1 ||
+      navigator.platform.indexOf('Linux') != -1) {
     return true;
   }
   return false;