chromium/chrome/browser/web_applications/web_app_utils_unittest.cc

// Copyright 2019 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/web_app_utils.h"

#include <memory>

#include "base/containers/adapters.h"
#include "base/files/file_path.h"
#include "base/test/scoped_feature_list.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom.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_id_constants.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_features.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "chromeos/ash/components/browser_context_helper/browser_context_types.h"
#include "components/user_manager/scoped_user_manager.h"
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

namespace web_app {

WebAppUtilsTest;
ElementsAre;

// Sanity check that iteration order of SortedSizesPx is ascending. The
// correctness of most usage of SortedSizesPx depends on this.
TEST(WebAppTest, SortedSizesPxIsAscending) {}

TEST(WebAppTest, ResolveEffectiveDisplayMode) {}

TEST(WebAppTest,
     ResolveEffectiveDisplayModeWithDisplayOverridesPreferUserMode) {}

TEST(WebAppTest,
     ResolveEffectiveDisplayModeWithDisplayOverridesFallbackToDisplayMode) {}

TEST(WebAppTest, ResolveEffectiveDisplayModeWithDisplayOverrides) {}

TEST(WebAppTest, ResolveEffectiveDisplayModeWithIsolatedWebApp) {}

TEST_F(WebAppUtilsTest, AreWebAppsEnabled) {}

TEST_F(WebAppUtilsTest, AreWebAppsUserInstallable) {}

TEST_F(WebAppUtilsTest, GetBrowserContextForWebApps) {}

TEST_F(WebAppUtilsTest, GetBrowserContextForWebAppMetrics) {}

#if BUILDFLAG(GOOGLE_CHROME_BRANDING) && BUILDFLAG(IS_CHROMEOS)
// TODO(http://b/331208955): Remove after migration.
TEST_F(WebAppUtilsTest, CanUserUninstallContainerApp) {
  EXPECT_FALSE(CanUserUninstallWebApp(
      kContainerAppId, WebAppManagementTypes({WebAppManagement::kDefault})));
  EXPECT_TRUE(CanUserUninstallWebApp(
      kContainerAppId, WebAppManagementTypes({WebAppManagement::kSync})));
}

// TODO(http://b/331208955): Remove after migration.
TEST_F(WebAppUtilsTest, ContainerAppWillBeSystemWebApp) {
  for (auto src : WebAppManagementTypes::All()) {
    EXPECT_THAT(
        WillBeSystemWebApp(kContainerAppId, WebAppManagementTypes({src})),
        src == WebAppManagement::kDefault);
  }
}
#endif  // BUILDFLAG(GOOGLE_CHROME_BRANDING) && BUILDFLAG(IS_CHROMEOS)

}  // namespace web_app