Remove the Whitelist for usage of management.installReplacementWebApp

This reverts commit 17ec7e69906c5818b071cdefdf13814c01230e81.

This whitelist is no longer needed. We want to open up this API for public use.

Original change's description:
> Whitelist usage of management.installReplacementWebApp
>
> This whitelists management.installReplacementWebApp to specific
> extensions as restrictions to ensure apps are related aren't yet
> implemented on the Webstore.
>
> For tests we need to generate manifest.json files based on the URL of
> the related app. Hence we can't check in a static crx/extension. This
> means that we need to provide a private key when generating the crx to
> ensure that the extension ID stays the same across test runs.
>
> Bug: 968407
> Change-Id: Ieceadeaf59011b7209fece3de06e89f2bea4b9e3
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1635118
> Commit-Queue: Raymes Khoury <[email protected]>
> Reviewed-by: Devlin <[email protected]>
> Reviewed-by: Ben Wells <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#665044}

[email protected], [email protected], [email protected]


(cherry picked from commit e9f4d714b4d3c7d9a01ba3ddc388d7156dcf4480)

Bug: 989799
Change-Id: I7662316011114dc2b5d50fc9a8ad1124b8749582
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1727869
Reviewed-by: Raymes Khoury <[email protected]>
Reviewed-by: Devlin <[email protected]>
Commit-Queue: Raymes Khoury <[email protected]>
Auto-Submit: Raymes Khoury <[email protected]>
Cr-Original-Commit-Position: refs/heads/master@{#683033}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1746110
Cr-Commit-Position: refs/branch-heads/3865@{#293}
Cr-Branched-From: 0cdcc6158160790658d1f033d3db873603250124-refs/heads/master@{#681094}
diff --git a/chrome/browser/extensions/api/management/management_apitest.cc b/chrome/browser/extensions/api/management/management_apitest.cc
index 9328e95..e1a883c 100644
--- a/chrome/browser/extensions/api/management/management_apitest.cc
+++ b/chrome/browser/extensions/api/management/management_apitest.cc
@@ -25,7 +25,6 @@
 #include "extensions/browser/extension_system.h"
 #include "extensions/browser/test_management_policy.h"
 #include "extensions/common/manifest.h"
-#include "extensions/common/switches.h"
 #include "extensions/test/extension_test_message_listener.h"
 #include "extensions/test/result_catcher.h"
 #include "extensions/test/test_extension_dir.h"
@@ -164,17 +163,9 @@
     ASSERT_TRUE(https_test_server_.Start());
   }
 
-  void SetUpCommandLine(base::CommandLine* command_line) override {
-    ExtensionManagementApiTest::SetUpCommandLine(command_line);
-    command_line->AppendSwitchASCII(
-        extensions::switches::kWhitelistedExtensionID,
-        "odfeghegfpmohakomgihhcnoboeecemb");
-  }
-
   void RunTest(const char* web_app_path,
                const char* background_script,
-               bool from_webstore,
-               bool whitelisted) {
+               bool from_webstore) {
     static constexpr char kManifest[] =
         R"({
             "name": "Management API Test",
@@ -183,56 +174,19 @@
             "background": { "scripts": ["background.js"] },
             "replacement_web_app": "%s"
           })";
-
-    static constexpr char kPem[] =
-        "-----BEGIN PRIVATE KEY-----"
-        "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCs5ycnzJEUSwlN"
-        "U7yAuywl8vro4dXew7Eijdd+gYwHAtaQyKxpeJHy09eusWKTfHEaOdqfqssqPMnl"
-        "XqoC+Tyt/24xM6rw6uSyAV78DRSAl7AxiyemxTh5P2rzaN4ytJayLpZDzwi38zeZ"
-        "QJC4TcSk04bclB2zfLFmMe8W53oxdE8vV6Xa2TPFigR6PV0FcRE40cCPHFhRTDwz"
-        "C04b/qW30Ceix2AeLPT4+qsGroq5kLt7zTgvaA+QToKeZNX41snk1w2u/IhOXG+J"
-        "0jyZnFU1lgnA9ScMW0laA+Ba2WXB5tLPgyRyyABRRaT5oiJCxRLQc+HFnMdUftGK"
-        "D4MKnf+/AgMBAAECggEADJ+/8x7zhMjJwBSaEcgYvBiWi0RZ6i7dkwlKL5lj0Os7"
-        "IU0VkYnVFiaze7TF3sDaPTD2Lmw48zeHAjE8NoVeEdIxiHQeSgLMedaxybNmyNDK"
-        "c4OWfI2vxuKDe4wvlQIscowGOqM2HsAqUg0tw9chwWsUUKyb0owLI8wHieOSv2OA"
-        "w8UlhflqkXLBUc4Mx3iqkIwAyrxQXT/vlA0M8/QvikK/zfeZYZ4f8tg23m3T0fV3"
-        "HC4k/Q09MFyUvURVYNpbPHrL83/ZbaHBniEjy+qBX4POO4xrKhow77tr/znB8bsA"
-        "T3mRwrEnYoIZmkwxlAdOMNxSYcAKZh4jPWOut0VQ0QKBgQDk341ysCaNzRq7nscR"
-        "RzDtpAA+UPcS2vcssXKDRjhsTp31qsUsVsYjTX+O/sv2uyb4HikYiFZOe3iPIfOl"
-        "ni7ZfhYFMMIZFjjP0cjQ7C/+ArxGb96DcTbRf7SNTDOLTtZy1jZSgIRek+2vvcr1"
-        "a/xPUMCxLEZdUPu+AVhKYHKHOQKBgQDBZVr04r4s5/BygRR3NhFgquI8ffdPHZzC"
-        "riEO1X/YOucTs+F+qwTvr25kRozpEjFsZJUibJTDngX9OziatAQdnjt5CtabOXd/"
-        "1rSgUadWEvRrcy/aaouCE1J+1unX6Kk5RHmIsK1YP3wC6JrHmqfnEVq9kaoUubTC"
-        "WHZfgjQGtwKBgF3B0nD8Bh8quVvIlGXYkwuWll7wzfYUaxMM8gsi1fRQVFcSCMm8"
-        "FljZ43pRmH5PdoxH1q/tEeX+oImJ8ASVgz2ncB/aNHkQaF+B4dDsIFDfD/+Ozkls"
-        "NHen5+/GGotj1WefpwsvCIqx8LmAd0cIYIihXP53U6/gf+/7Hw8A6YnJAoGAEbhs"
-        "xiWEkW7LLGLBck7k9ruRsUNFht1KwNfdtZNAfJqhE8AWuFmJQUEM12lTfgOpvanV"
-        "tGrIksgG+nYTsLEv81rNTkD8+wof9fnBYTM6Jvvjo3jReKzsjYWhuHeOw7bQ0quA"
-        "i1LM/1oJzeZsUD/OhLClZNtU/0Mo2enrJsMyay8CgYEApCQ8BDMYewQj2MCM92Vw"
-        "DWDzqQpfaGIG/eDAeEtdicbfdih3zUWfhEVOpnvf7s7nS8bMVpAo9pGW6sT/s8eX"
-        "POGiP9efxb2uHsX06pkAYZm9nddIliWnm0/eDBmSSXPymAZaNYFrex4wxMII20K/"
-        "ZX1nuseC+Lx0yzxa/c+iCWg="
-        "-----END PRIVATE KEY-----";
-
     extensions::TestExtensionDir extension_dir;
     extension_dir.WriteManifest(base::StringPrintf(
         kManifest, https_test_server_.GetURL(web_app_path).spec().c_str()));
     extension_dir.WriteFile(FILE_PATH_LITERAL("background.js"),
                             background_script);
-
-    base::FilePath crx;
-    if (whitelisted)
-      crx = extension_dir.PackWithPem(kPem);
-    else
-      crx = extension_dir.Pack();
-
     extensions::ResultCatcher catcher;
     if (from_webstore) {
       // |expected_change| is the expected change in the number of installed
       // extensions.
-      ASSERT_TRUE(InstallExtensionFromWebstore(crx, 1 /* expected_change */));
+      ASSERT_TRUE(InstallExtensionFromWebstore(extension_dir.UnpackedPath(),
+                                               1 /* expected_change */));
     } else {
-      ASSERT_TRUE(LoadExtension(crx));
+      ASSERT_TRUE(LoadExtension(extension_dir.UnpackedPath()));
     }
 
     ASSERT_TRUE(catcher.GetNextResult()) << catcher.message();
@@ -241,16 +195,6 @@
   net::EmbeddedTestServer https_test_server_;
 };
 
-IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotWhitelisted) {
-  static constexpr char kBackground[] = R"(
-    chrome.test.assertEq(undefined, chrome.management.installReplacementWebApp);
-    chrome.test.notifyPass();
-  )";
-
-  RunTest("/management/install_replacement_web_app/good_web_app/index.html",
-          kBackground, true /* from_webstore */, false /* whitelisted */);
-}
-
 IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotWebstore) {
   static constexpr char kBackground[] = R"(
   chrome.management.installReplacementWebApp(function() {
@@ -260,7 +204,7 @@
   });)";
 
   RunTest("/management/install_replacement_web_app/good_web_app/index.html",
-          kBackground, false /* from_webstore */, true /* whitelisted */);
+          kBackground, false /* from_webstore */);
 }
 
 IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NoGesture) {
@@ -272,7 +216,7 @@
   });)";
 
   RunTest("/management/install_replacement_web_app/good_web_app/index.html",
-          kBackground, true /* from_webstore */, true /* whitelisted */);
+          kBackground, true /* from_webstore */);
 }
 
 IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, NotInstallableWebApp) {
@@ -286,7 +230,7 @@
          });)";
 
   RunTest("/management/install_replacement_web_app/bad_web_app/index.html",
-          kBackground, true /* from_webstore */, true /* whitelisted */);
+          kBackground, true /* from_webstore */);
 }
 
 IN_PROC_BROWSER_TEST_F(InstallReplacementWebAppApiTest, InstallableWebApp) {
@@ -320,8 +264,7 @@
       web_app::WebAppProviderBase::GetProviderBase(browser()->profile());
   EXPECT_FALSE(provider->registrar().IsInstalled(good_web_app_url));
 
-  RunTest(kGoodWebAppURL, kBackground, true /* from_webstore */,
-          true /* whitelisted */);
+  RunTest(kGoodWebAppURL, kBackground, true /* from_webstore */);
   EXPECT_TRUE(provider->registrar().IsInstalled(good_web_app_url));
   chrome::SetAutoAcceptPWAInstallConfirmationForTesting(false);
 }
diff --git a/extensions/common/api/_api_features.json b/extensions/common/api/_api_features.json
index 8eb14c0..993ef7cf 100644
--- a/extensions/common/api/_api_features.json
+++ b/extensions/common/api/_api_features.json
@@ -305,16 +305,7 @@
   "management.installReplacementWebApp": {
     "dependencies": ["manifest:replacement_web_app"],
     "channel": "stable",
-    "extension_types": ["extension"],
-    "whitelist": [
-      "E7E2461CE072DF036CF9592740196159E2D7C089",  // https://crbug.com/968407
-      "A74A4D44C7CFCD8844830E6140C8D763E12DD8F3",  // https://crbug.com/968407
-      "312745D9BF916161191143F6490085EEA0434997",  // https://crbug.com/968407
-      "53041A2FA309EECED01FFC751E7399186E860B2C",  // https://crbug.com/968407
-      "A07A5B743CD82A1C2579DB77D353C98A23201EEF",  // https://crbug.com/968407
-      "2D22CDB6583FD0A13758AEBE8B15E45208B4E9A7",  // https://crbug.com/968407
-      "0F42756099D914A026DADFA182871C015735DD95"   // https://crbug.com/968407
-    ]
+    "extension_types": ["extension"]
   },
   "management.uninstallSelf": {
     "dependencies": [],
diff --git a/extensions/test/test_extension_dir.cc b/extensions/test/test_extension_dir.cc
index 9367e7c..cb4edb8 100644
--- a/extensions/test/test_extension_dir.cc
+++ b/extensions/test/test_extension_dir.cc
@@ -47,20 +47,12 @@
 }
 
 base::FilePath TestExtensionDir::Pack() {
-  return PackWithPem(base::StringPiece());
-}
-
-base::FilePath TestExtensionDir::PackWithPem(base::StringPiece pem) {
   base::ScopedAllowBlockingForTesting allow_blocking;
   ExtensionCreator creator;
   base::FilePath crx_path =
       crx_dir_.GetPath().Append(FILE_PATH_LITERAL("ext.crx"));
   base::FilePath pem_path =
       crx_dir_.GetPath().Append(FILE_PATH_LITERAL("ext.pem"));
-
-  if (!pem.empty())
-    base::WriteFile(pem_path, pem.data(), pem.size());
-
   base::FilePath pem_in_path, pem_out_path;
   if (base::PathExists(pem_path))
     pem_in_path = pem_path;
diff --git a/extensions/test/test_extension_dir.h b/extensions/test/test_extension_dir.h
index 8b14533c..a65311a 100644
--- a/extensions/test/test_extension_dir.h
+++ b/extensions/test/test_extension_dir.h
@@ -38,9 +38,6 @@
   // .crx. Multiple calls to Pack() will produce extensions with the same ID.
   base::FilePath Pack();
 
-  // The same as Pack() but allows the caller to provide a private key.
-  base::FilePath PackWithPem(base::StringPiece pem);
-
   // Returns the path to the unpacked directory.
   base::FilePath UnpackedPath();