OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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_secondary_apps_info.h" |
| 7 #include "extensions/common/manifest_test.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace extensions { |
| 11 |
| 12 using KioskSecondaryAppsInfoManifestTest = ManifestTest; |
| 13 |
| 14 TEST_F(KioskSecondaryAppsInfoManifestTest, NoSecondaryApps) { |
| 15 scoped_refptr<Extension> extension( |
| 16 LoadAndExpectSuccess("kiosk_secondary_app_no_secondary_app.json")); |
| 17 EXPECT_FALSE(KioskSecondaryAppsInfo::HaveSecondaryApps(extension.get())); |
| 18 } |
| 19 |
| 20 TEST_F(KioskSecondaryAppsInfoManifestTest, MultipleSecondaryApps) { |
| 21 const std::vector<std::string> expected_ids = { |
| 22 "fiehokkcgaojmbhfhlpiheggjhaedjoc", "ihplaomghjbeafnpnjkhppmfpnmdihgd"}; |
| 23 scoped_refptr<Extension> extension( |
| 24 LoadAndExpectSuccess("kiosk_secondary_app_multi_apps.json")); |
| 25 EXPECT_TRUE(KioskSecondaryAppsInfo::HaveSecondaryApps(extension.get())); |
| 26 KioskSecondaryAppsInfo* info = KioskSecondaryAppsInfo::Get(extension.get()); |
| 27 EXPECT_NE(nullptr, info); |
| 28 std::vector<std::string> parsed_ids(info->ids); |
| 29 std::sort(parsed_ids.begin(), parsed_ids.end()); |
| 30 EXPECT_TRUE( |
| 31 std::equal(expected_ids.begin(), expected_ids.end(), parsed_ids.begin())); |
| 32 } |
| 33 |
| 34 } // namespace extensions |
OLD | NEW |