| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | |
| 6 | |
| 7 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace errors = extension_manifest_errors; | |
| 11 | |
| 12 TEST_F(ExtensionManifestTest, OptionsPageInApps) { | |
| 13 scoped_refptr<extensions::Extension> extension; | |
| 14 | |
| 15 // Allow options page with absolute URL in hosted apps. | |
| 16 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); | |
| 17 EXPECT_STREQ("http", | |
| 18 extension->options_url().scheme().c_str()); | |
| 19 EXPECT_STREQ("example.com", | |
| 20 extension->options_url().host().c_str()); | |
| 21 EXPECT_STREQ("options.html", | |
| 22 extension->options_url().ExtractFileName().c_str()); | |
| 23 | |
| 24 Testcase testcases[] = { | |
| 25 // Forbid options page with relative URL in hosted apps. | |
| 26 Testcase("hosted_app_relative_options.json", | |
| 27 errors::kInvalidOptionsPageInHostedApp), | |
| 28 | |
| 29 // Forbid options page with non-(http|https) scheme in hosted app. | |
| 30 Testcase("hosted_app_file_options.json", | |
| 31 errors::kInvalidOptionsPageInHostedApp), | |
| 32 | |
| 33 // Forbid absolute URL for options page in packaged apps. | |
| 34 Testcase("packaged_app_absolute_options.json", | |
| 35 errors::kInvalidOptionsPageExpectUrlInPackage) | |
| 36 }; | |
| 37 RunTestcases(testcases, arraysize(testcases), | |
| 38 EXPECT_TYPE_ERROR); | |
| 39 } | |
| OLD | NEW |