Chromium Code Reviews| Index: extensions/common/manifest_handlers/kiosk_mode_info_unittest.cc |
| diff --git a/extensions/common/manifest_handlers/kiosk_mode_info_unittest.cc b/extensions/common/manifest_handlers/kiosk_mode_info_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..44a21f0c1b17916b58cd0125500cce4090c62811 |
| --- /dev/null |
| +++ b/extensions/common/manifest_handlers/kiosk_mode_info_unittest.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
|
not at google - send to devlin
2015/09/01 22:51:11
No (c)
jennyz
2015/09/02 21:42:23
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "extensions/common/manifest_constants.h" |
| +#include "extensions/common/manifest_handlers/kiosk_mode_info.h" |
| +#include "extensions/common/manifest_test.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace extensions { |
| + |
| +using KioskModeInfoManifestTest = ManifestTest; |
| + |
| +TEST_F(KioskModeInfoManifestTest, NoSecondaryApps) { |
| + scoped_refptr<Extension> extension( |
| + LoadAndExpectSuccess("kiosk_secondary_app_no_secondary_app.json")); |
| + EXPECT_FALSE(KioskModeInfo::HasSecondaryApps(extension.get())); |
| +} |
| + |
| +TEST_F(KioskModeInfoManifestTest, MultipleSecondaryApps) { |
| + const std::vector<std::string> expected_ids = { |
| + "fiehokkcgaojmbhfhlpiheggjhaedjoc", "ihplaomghjbeafnpnjkhppmfpnmdihgd"}; |
| + scoped_refptr<Extension> extension( |
| + LoadAndExpectSuccess("kiosk_secondary_app_multi_apps.json")); |
| + EXPECT_TRUE(KioskModeInfo::HasSecondaryApps(extension.get())); |
| + KioskModeInfo* info = KioskModeInfo::Get(extension.get()); |
| + EXPECT_NE(nullptr, info); |
| + std::vector<std::string> parsed_ids(info->secondary_app_ids); |
| + std::sort(parsed_ids.begin(), parsed_ids.end()); |
| + EXPECT_TRUE( |
| + std::equal(expected_ids.begin(), expected_ids.end(), parsed_ids.begin())); |
| +} |
| + |
| +} // namespace extensions |