OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
6 | 6 |
7 #include "chrome/common/extensions/extension_manifest_constants.h" | 7 #include "chrome/common/extensions/extension_manifest_constants.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace errors = extension_manifest_errors; | 10 namespace errors = extension_manifest_errors; |
11 | 11 |
12 TEST_F(ExtensionManifestTest, OptionsPageInApps) { | 12 TEST_F(ExtensionManifestTest, OptionsPageInApps) { |
13 scoped_refptr<Extension> extension; | 13 scoped_refptr<extensions::Extension> extension; |
14 | 14 |
15 // Allow options page with absolute URL in hosted apps. | 15 // Allow options page with absolute URL in hosted apps. |
16 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); | 16 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); |
17 EXPECT_STREQ("http", | 17 EXPECT_STREQ("http", |
18 extension->options_url().scheme().c_str()); | 18 extension->options_url().scheme().c_str()); |
19 EXPECT_STREQ("example.com", | 19 EXPECT_STREQ("example.com", |
20 extension->options_url().host().c_str()); | 20 extension->options_url().host().c_str()); |
21 EXPECT_STREQ("options.html", | 21 EXPECT_STREQ("options.html", |
22 extension->options_url().ExtractFileName().c_str()); | 22 extension->options_url().ExtractFileName().c_str()); |
23 | 23 |
24 Testcase testcases[] = { | 24 Testcase testcases[] = { |
25 // Forbid options page with relative URL in hosted apps. | 25 // Forbid options page with relative URL in hosted apps. |
26 Testcase("hosted_app_relative_options.json", | 26 Testcase("hosted_app_relative_options.json", |
27 errors::kInvalidOptionsPageInHostedApp), | 27 errors::kInvalidOptionsPageInHostedApp), |
28 | 28 |
29 // Forbid options page with non-(http|https) scheme in hosted app. | 29 // Forbid options page with non-(http|https) scheme in hosted app. |
30 Testcase("hosted_app_file_options.json", | 30 Testcase("hosted_app_file_options.json", |
31 errors::kInvalidOptionsPageInHostedApp), | 31 errors::kInvalidOptionsPageInHostedApp), |
32 | 32 |
33 // Forbid absolute URL for options page in packaged apps. | 33 // Forbid absolute URL for options page in packaged apps. |
34 Testcase("packaged_app_absolute_options.json", | 34 Testcase("packaged_app_absolute_options.json", |
35 errors::kInvalidOptionsPageExpectUrlInPackage) | 35 errors::kInvalidOptionsPageExpectUrlInPackage) |
36 }; | 36 }; |
37 RunTestcases(testcases, arraysize(testcases), | 37 RunTestcases(testcases, arraysize(testcases), |
38 EXPECT_TYPE_ERROR); | 38 EXPECT_TYPE_ERROR); |
39 } | 39 } |
OLD | NEW |