Allow autotest extension to access system.display

system.display is currently only allowed for a few cases.  Grant
autotest extension to use the API for test purpose, too.

TEST=autotest works
BUG=712705

Review-Url: https://codereview.chromium.org/2862223003
Cr-Commit-Position: refs/heads/master@{#470124}
diff --git a/extensions/browser/api/system_display/system_display_api.cc b/extensions/browser/api/system_display/system_display_api.cc
index 66198ac..3732621 100644
--- a/extensions/browser/api/system_display/system_display_api.cc
+++ b/extensions/browser/api/system_display/system_display_api.cc
@@ -16,6 +16,7 @@
 #include "content/public/browser/web_contents_observer.h"
 #include "extensions/browser/api/system_display/display_info_provider.h"
 #include "extensions/common/api/system_display.h"
+#include "extensions/common/permissions/permissions_data.h"
 
 #if defined(OS_CHROMEOS)
 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
@@ -175,6 +176,11 @@
 }
 
 bool SystemDisplayFunction::ShouldRestrictToKioskAndWebUI() {
+  // Allow autotest extension to access for Chrome OS testing.
+  if (extension()->permissions_data()->HasAPIPermission(
+      APIPermission::kAutoTestPrivate)) {
+    return false;
+  }
   return true;
 }