Enable Enterprise enrollment on desktop builds.
[chromium-blink-merge.git] / chrome / common / extensions / manifest_tests / extension_manifests_kiosk_unittest.cc
blobf79d79d23585a68cd66e053cb545d2776c0c8729
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6 #include "extensions/common/extension.h"
7 #include "extensions/common/manifest_constants.h"
8 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 namespace extensions {
13 class ExtensionManifestKioskModeTest : public ExtensionManifestTest {
16 TEST_F(ExtensionManifestKioskModeTest, InvalidKioskEnabled) {
17 LoadAndExpectError("kiosk_enabled_invalid.json",
18 manifest_errors::kInvalidKioskEnabled);
21 TEST_F(ExtensionManifestKioskModeTest, KioskEnabledHostedApp) {
22 scoped_refptr<Extension> extension(
23 LoadAndExpectSuccess("kiosk_enabled_hosted_app.json"));
24 EXPECT_FALSE(KioskModeInfo::IsKioskEnabled(extension.get()));
27 TEST_F(ExtensionManifestKioskModeTest, KioskEnabledPackagedApp) {
28 scoped_refptr<Extension> extension(
29 LoadAndExpectSuccess("kiosk_enabled_packaged_app.json"));
30 EXPECT_FALSE(KioskModeInfo::IsKioskEnabled(extension.get()));
33 TEST_F(ExtensionManifestKioskModeTest, KioskEnabledExtension) {
34 scoped_refptr<Extension> extension(
35 LoadAndExpectSuccess("kiosk_enabled_extension.json"));
36 EXPECT_FALSE(KioskModeInfo::IsKioskEnabled(extension.get()));
39 TEST_F(ExtensionManifestKioskModeTest, KioskEnabledPlatformApp) {
40 scoped_refptr<Extension> extension(
41 LoadAndExpectSuccess("kiosk_enabled_platform_app.json"));
42 EXPECT_TRUE(KioskModeInfo::IsKioskEnabled(extension.get()));
45 TEST_F(ExtensionManifestKioskModeTest, KioskDisabledPlatformApp) {
46 scoped_refptr<Extension> extension(
47 LoadAndExpectSuccess("kiosk_disabled_platform_app.json"));
48 EXPECT_FALSE(KioskModeInfo::IsKioskEnabled(extension.get()));
51 TEST_F(ExtensionManifestKioskModeTest, KioskDefaultPlatformApp) {
52 scoped_refptr<Extension> extension(
53 LoadAndExpectSuccess("kiosk_default_platform_app.json"));
54 EXPECT_FALSE(KioskModeInfo::IsKioskEnabled(extension.get()));
55 EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
58 TEST_F(ExtensionManifestKioskModeTest, KioskEnabledDefaultRequired) {
59 scoped_refptr<Extension> extension(
60 LoadAndExpectSuccess("kiosk_enabled_platform_app.json"));
61 EXPECT_TRUE(KioskModeInfo::IsKioskEnabled(extension.get()));
62 EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
65 TEST_F(ExtensionManifestKioskModeTest, KioskOnlyPlatformApp) {
66 scoped_refptr<Extension> extension(
67 LoadAndExpectSuccess("kiosk_only_platform_app.json"));
68 EXPECT_TRUE(KioskModeInfo::IsKioskOnly(extension.get()));
71 TEST_F(ExtensionManifestKioskModeTest, KioskOnlyInvalid) {
72 LoadAndExpectError("kiosk_only_invalid.json",
73 manifest_errors::kInvalidKioskOnly);
76 TEST_F(ExtensionManifestKioskModeTest, KioskOnlyButNotEnabled) {
77 LoadAndExpectError("kiosk_only_not_enabled.json",
78 manifest_errors::kInvalidKioskOnlyButNotEnabled);
81 TEST_F(ExtensionManifestKioskModeTest, KioskOnlyHostedApp) {
82 scoped_refptr<Extension> extension(
83 LoadAndExpectSuccess("kiosk_only_hosted_app.json"));
84 EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
87 TEST_F(ExtensionManifestKioskModeTest, KioskOnlyPackagedApp) {
88 scoped_refptr<Extension> extension(
89 LoadAndExpectSuccess("kiosk_only_packaged_app.json"));
90 EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
93 TEST_F(ExtensionManifestKioskModeTest, KioskOnlyExtension) {
94 scoped_refptr<Extension> extension(
95 LoadAndExpectSuccess("kiosk_only_extension.json"));
96 EXPECT_FALSE(KioskModeInfo::IsKioskOnly(extension.get()));
99 } // namespace extensions