chromium/chrome/browser/web_applications/externally_managed_app_manager_unittest.cc

// Copyright 2018 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/web_applications/externally_managed_app_manager.h"

#include <algorithm>
#include <iterator>
#include <optional>
#include <sstream>
#include <vector>

#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/ranges/algorithm.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
#include "base/test/test_future.h"
#include "chrome/browser/apps/app_service/app_service_proxy.h"
#include "chrome/browser/apps/app_service/app_service_proxy_factory.h"
#include "chrome/browser/apps/app_service/publishers/app_publisher.h"
#include "chrome/browser/web_applications/external_install_options.h"
#include "chrome/browser/web_applications/externally_managed_app_manager.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom-shared.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.h"
#include "chrome/browser/web_applications/policy/web_app_policy_manager.h"
#include "chrome/browser/web_applications/test/fake_externally_managed_app_manager.h"
#include "chrome/browser/web_applications/test/fake_web_app_provider.h"
#include "chrome/browser/web_applications/test/fake_web_contents_manager.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/test/web_app_test_utils.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_helpers.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/browser/web_applications/web_app_registry_update.h"
#include "chrome/browser/web_applications/web_app_sync_bridge.h"
#include "chrome/common/chrome_features.h"
#include "components/services/app_service/public/cpp/app_types.h"
#include "components/webapps/browser/install_result_code.h"
#include "components/webapps/browser/web_contents/web_app_url_loader.h"
#include "components/webapps/common/web_page_metadata.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h"
#include "third_party/blink/public/mojom/manifest/manifest.mojom-forward.h"
#include "url/gurl.h"
#include "url/origin.h"

namespace web_app {

class ExternallyManagedAppManagerTest : public WebAppTest {};

// Test that destroying ExternallyManagedAppManager during a synchronize call
// that installs an app doesn't crash. Regression test for
// https://crbug.com/962808
TEST_F(ExternallyManagedAppManagerTest, DestroyDuringInstallInSynchronize) {}

// Test that destroying ExternallyManagedAppManager during a synchronize call
// that uninstalls an app doesn't crash. Regression test for
// https://crbug.com/962808
TEST_F(ExternallyManagedAppManagerTest, DestroyDuringUninstallInSynchronize) {}

TEST_F(ExternallyManagedAppManagerTest, SynchronizeInstalledApps) {}

namespace {

ElementsAre;
Eq;
IsEmpty;
UnorderedElementsAre;

// Test harness that keep the system as real as possible.
class ExternallyAppManagerTest : public WebAppTest {};

TEST_F(ExternallyAppManagerTest, NoNetworkNoPlaceholder) {}

TEST_F(ExternallyAppManagerTest, SimpleInstall) {}

TEST_F(ExternallyAppManagerTest, TwoInstallUrlsSameApp) {}

TEST_F(ExternallyAppManagerTest, RemovingInstallUrlsFromSource) {}

TEST_F(ExternallyAppManagerTest, InstallUrlChanges) {}

TEST_F(ExternallyAppManagerTest, PolicyAppOverridesUserInstalledApp) {}

TEST_F(ExternallyAppManagerTest, NoNetworkWithPlaceholder) {}

TEST_F(ExternallyAppManagerTest, RedirectInstallUrlPlaceholder) {}

TEST_F(ExternallyAppManagerTest, PlaceholderResolvedFromSynchronize) {}

TEST_F(ExternallyAppManagerTest, PlaceholderResolvedFromInstallNow) {}

TEST_F(ExternallyAppManagerTest, TwoAppsSameInstallUrlSameSourceInstallNow) {}

TEST_F(ExternallyAppManagerTest, TwoAppsSameInstallUrlTwoSourcesInstallNow) {}

TEST_F(ExternallyAppManagerTest, TwoAppsSameInstallUrlTwoSourcesSynchronize) {}

TEST_F(ExternallyAppManagerTest, PlaceholderFixedBySecondInstallUrlInstallNow) {}

TEST_F(ExternallyAppManagerTest,
       PlaceholderFixedBySecondInstallUrlSynchronize) {}

TEST_F(ExternallyAppManagerTest, PlaceholderFullInstallConflictCanUpdate) {}

}  // namespace
}  // namespace web_app