[Extensions] Remove deprecated ExtensionService member function.

This CL removes ExtensionService::GetExtensionById().

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

Bug: 489687
Change-Id: I3919bd1b0b76f32190750a63f3088cfe528e6a03
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1704521
Commit-Queue: David Bertoni <[email protected]>
Reviewed-by: Karan Bhatia <[email protected]>
Cr-Commit-Position: refs/heads/master@{#683709}
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc
index 163b4b9..b7e69b88 100644
--- a/chrome/browser/extensions/extension_service_sync_unittest.cc
+++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -73,15 +73,16 @@
 #include "chrome/common/pref_names.h"
 #endif
 
-using extensions::api_test_utils::RunFunctionAndReturnSingleResult;
 using extensions::AppSorting;
 using extensions::Extension;
 using extensions::ExtensionPrefs;
+using extensions::ExtensionRegistry;
 using extensions::ExtensionSyncData;
 using extensions::ExtensionSystem;
 using extensions::Manifest;
 using extensions::PermissionSet;
 using extensions::WebstorePrivateIsPendingCustodianApprovalFunction;
+using extensions::api_test_utils::RunFunctionAndReturnSingleResult;
 using syncer::SyncChange;
 using syncer::SyncChangeList;
 using testing::Mock;
@@ -361,7 +362,8 @@
   ASSERT_EQ(3u, loaded_.size());
 
   // We start enabled.
-  const Extension* extension = service()->GetExtensionById(good0, true);
+  const Extension* extension =
+      registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY);
   ASSERT_TRUE(extension);
   ASSERT_TRUE(service()->IsExtensionEnabled(good0));
 
@@ -560,8 +562,10 @@
                               extensions::disable_reason::DISABLE_USER_ACTION);
   ASSERT_FALSE(service()->IsExtensionEnabled(good2));
 
-  const Extension* extension0 = service()->GetExtensionById(good0, true);
-  const Extension* extension2 = service()->GetExtensionById(good2, true);
+  const Extension* extension0 =
+      registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY);
+  const Extension* extension2 =
+      registry()->GetExtensionById(good2, ExtensionRegistry::COMPATIBILITY);
   ASSERT_TRUE(extensions::sync_helper::IsSyncable(extension0));
   ASSERT_TRUE(extensions::sync_helper::IsSyncable(extension2));
 
@@ -619,7 +623,8 @@
   // any outgoing changes.
 
   {
-    const Extension* extension = service()->GetExtensionById(good0, true);
+    const Extension* extension =
+        registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY);
     ASSERT_TRUE(extension);
 
     // Disable the extension.
@@ -634,7 +639,8 @@
   }
 
   {
-    const Extension* extension = service()->GetExtensionById(good0, true);
+    const Extension* extension =
+        registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY);
     ASSERT_TRUE(extension);
 
     // Set incognito enabled to true.
@@ -649,7 +655,8 @@
   }
 
   {
-    const Extension* extension = service()->GetExtensionById(good0, true);
+    const Extension* extension =
+        registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY);
     ASSERT_TRUE(extension);
 
     // Add another disable reason.
@@ -666,7 +673,8 @@
   }
 
   {
-    const Extension* extension = service()->GetExtensionById(good0, true);
+    const Extension* extension =
+        registry()->GetExtensionById(good0, ExtensionRegistry::COMPATIBILITY);
     ASSERT_TRUE(extension);
 
     // Uninstall the extension.
@@ -1073,20 +1081,24 @@
 
   // Should do nothing.
   extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
-  EXPECT_FALSE(service()->GetExtensionById(good_crx, true));
+  EXPECT_FALSE(
+      registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY));
 
   // Install the extension.
   base::FilePath extension_path = data_dir().AppendASCII("good.crx");
   InstallCRX(extension_path, INSTALL_NEW);
-  EXPECT_TRUE(service()->GetExtensionById(good_crx, true));
+  EXPECT_TRUE(
+      registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY));
 
   // Should uninstall the extension.
   extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
-  EXPECT_FALSE(service()->GetExtensionById(good_crx, true));
+  EXPECT_FALSE(
+      registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY));
 
   // Should again do nothing.
   extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
-  EXPECT_FALSE(service()->GetExtensionById(good_crx, true));
+  EXPECT_FALSE(
+      registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY));
 }
 
 TEST_F(ExtensionServiceSyncTest, ProcessSyncDataWrongType) {
@@ -1097,7 +1109,8 @@
   // Install the extension.
   base::FilePath extension_path = data_dir().AppendASCII("good.crx");
   InstallCRX(extension_path, INSTALL_NEW);
-  EXPECT_TRUE(service()->GetExtensionById(good_crx, true));
+  EXPECT_TRUE(
+      registry()->GetExtensionById(good_crx, ExtensionRegistry::COMPATIBILITY));
 
   sync_pb::EntitySpecifics specifics;
   sync_pb::AppSpecifics* app_specifics = specifics.mutable_app();
@@ -1115,7 +1128,8 @@
 
     // Should do nothing
     extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
-    EXPECT_TRUE(service()->GetExtensionById(good_crx, true));
+    EXPECT_TRUE(registry()->GetExtensionById(good_crx,
+                                             ExtensionRegistry::COMPATIBILITY));
   }
 
   {
@@ -1126,7 +1140,8 @@
 
     // Should again do nothing.
     extension_sync_service()->ProcessSyncChanges(FROM_HERE, list);
-    EXPECT_TRUE(service()->GetExtensionById(good_crx, false));
+    EXPECT_TRUE(
+        registry()->GetExtensionById(good_crx, ExtensionRegistry::ENABLED));
   }
 }