OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 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" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 using KioskModeInfoManifestTest = ManifestTest; |
| 13 |
| 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())); |
| 18 } |
| 19 |
| 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)); |
| 33 } |
| 34 |
| 35 } // namespace extensions |
OLD | NEW |