Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / manifest_handlers / kiosk_mode_info_unittest.cc
blob9e42c1899d2560245d621b2dfac29b4eb5e30815
1 // Copyright 2015 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 "extensions/common/manifest_constants.h"
6 #include "extensions/common/manifest_handlers/kiosk_mode_info.h"
7 #include "extensions/common/manifest_test.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace extensions {
12 using KioskModeInfoManifestTest = ManifestTest;
14 TEST_F(KioskModeInfoManifestTest, NoSecondaryApps) {
15 scoped_refptr<Extension> extension(
16 LoadAndExpectSuccess("kiosk_secondary_app_no_secondary_app.json"));
17 EXPECT_FALSE(KioskModeInfo::HasSecondaryApps(extension.get()));
20 TEST_F(KioskModeInfoManifestTest, MultipleSecondaryApps) {
21 const std::string expected_ids[] = {
22 "fiehokkcgaojmbhfhlpiheggjhaedjoc",
23 "ihplaomghjbeafnpnjkhppmfpnmdihgd"};
24 scoped_refptr<Extension> extension(
25 LoadAndExpectSuccess("kiosk_secondary_app_multi_apps.json"));
26 EXPECT_TRUE(KioskModeInfo::HasSecondaryApps(extension.get()));
27 KioskModeInfo* info = KioskModeInfo::Get(extension.get());
28 EXPECT_NE(nullptr, info);
29 std::vector<std::string> parsed_ids(info->secondary_app_ids);
30 std::sort(parsed_ids.begin(), parsed_ids.end());
31 EXPECT_TRUE(
32 std::equal(parsed_ids.begin(), parsed_ids.end(), expected_ids));
35 } // namespace extensions