// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/extensions/forced_extensions/force_installed_tracker.h" #include <map> #include "base/scoped_observation.h" #include "base/values.h" #include "chrome/browser/extensions/forced_extensions/force_installed_test_base.h" #include "extensions/common/extension.h" #include "testing/gtest/include/gtest/gtest.h" namespace extensions { ExtensionStatus; ExtensionOrigin; class ForceInstalledTrackerTest : public ForceInstalledTestBase, public ForceInstalledTracker::Observer { … }; TEST_F(ForceInstalledTrackerTest, EmptyForcelist) { … } TEST_F(ForceInstalledTrackerTest, EmptyForcelistAndThenUpdated) { … } TEST_F(ForceInstalledTrackerTest, BeforeForceInstallPolicy) { … } // This test verifies that OnForceInstalledExtensionsLoaded() is called once all // force installed extensions have successfully loaded and // OnForceInstalledExtensionsReady() is called once all those extensions have // become ready for use. TEST_F(ForceInstalledTrackerTest, AllExtensionsInstalled) { … } // This test verifies that OnForceInstalledExtensionsLoaded() is not called till // all extensions have either successfully loaded or failed. TEST_F(ForceInstalledTrackerTest, ExtensionPendingInstall) { … } // This test verifies that applying a new policy value for force installed // extensions once all the extensions in the previous value have loaded does not // trigger the observers again. TEST_F(ForceInstalledTrackerTest, ObserversOnlyCalledOnce) { … } // This test verifies that observer is called if force installed extensions are // either successfully loaded or failed. TEST_F(ForceInstalledTrackerTest, ExtensionsInstallationFailed) { … } // This test tracks the status of the force installed extensions in // |ForceInstalledTracker::extensions_| as the extensions are either loaded or // failed. TEST_F(ForceInstalledTrackerTest, ExtensionsStatus) { … } // This test verifies that resetting the policy before all force installed // extensions are either loaded or failed does not call the observers. TEST_F(ForceInstalledTrackerTest, ExtensionsInstallationCancelled) { … } // This test verifies that READY state observer is called when each force // installed extension is either ready for use or failed. TEST_F(ForceInstalledTrackerTest, AllExtensionsReady) { … } } // namespace extensions