chromium/chrome/common/extensions/manifest_tests/extension_manifests_kiosk_unittest.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handlers/kiosk_mode_info.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace extensions {

ExtensionManifestKioskModeTest;

TEST_F(ExtensionManifestKioskModeTest, InvalidKioskEnabled) {}

TEST_F(ExtensionManifestKioskModeTest, KioskEnabledHostedApp) {}

TEST_F(ExtensionManifestKioskModeTest, KioskEnabledPackagedApp) {}

TEST_F(ExtensionManifestKioskModeTest, KioskEnabledExtension) {}

TEST_F(ExtensionManifestKioskModeTest, KioskEnabledPlatformApp) {}

TEST_F(ExtensionManifestKioskModeTest, KioskDisabledPlatformApp) {}

TEST_F(ExtensionManifestKioskModeTest, KioskDefaultPlatformApp) {}

TEST_F(ExtensionManifestKioskModeTest, KioskEnabledDefaultRequired) {}

// 'kiosk_only' key should be set only from ChromeOS.
#if BUILDFLAG(IS_CHROMEOS_ASH)
TEST_F(ExtensionManifestKioskModeTest, KioskOnlyPlatformApp) {
  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess("kiosk_only_platform_app.json"));
  EXPECT_TRUE(KioskModeInfo::IsKioskOnly(extension.get()));
}

TEST_F(ExtensionManifestKioskModeTest, KioskOnlyInvalid) {
  LoadAndExpectError("kiosk_only_invalid.json",
                     manifest_errors::kInvalidKioskOnly);
}

TEST_F(ExtensionManifestKioskModeTest, KioskOnlyButNotEnabled) {
  LoadAndExpectError("kiosk_only_not_enabled.json",
                     manifest_errors::kInvalidKioskOnlyButNotEnabled);
}

TEST_F(ExtensionManifestKioskModeTest, KioskOnlyHostedApp) {
  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess("kiosk_only_hosted_app.json"));
  EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
}

TEST_F(ExtensionManifestKioskModeTest, KioskOnlyPackagedApp) {
  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess("kiosk_only_packaged_app.json"));
  EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
}

TEST_F(ExtensionManifestKioskModeTest, KioskOnlyExtension) {
  scoped_refptr<Extension> extension(
      LoadAndExpectSuccess("kiosk_only_extension.json"));
  EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
}
#else
TEST_F(ExtensionManifestKioskModeTest, KioskOnlyFromNonChromeos) {}
#endif  // BUILDFLAG(IS_CHROMEOS_ASH)

}  // namespace extensions