| 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/extension_manifest_constants.h" | 5 #include "chrome/common/extensions/extension_manifest_constants.h" |
| 6 #include "chrome/common/extensions/manifest_handler.h" | 6 #include "chrome/common/extensions/manifest_handler.h" |
| 7 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" | 7 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
| 8 #include "chrome/common/extensions/manifest_url_handler.h" | 8 #include "chrome/common/extensions/manifest_url_handler.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace errors = extension_manifest_errors; | 11 namespace errors = extension_manifest_errors; |
| 12 | 12 |
| 13 class OptionsPageManifestTest : public ExtensionManifestTest { | 13 class OptionsPageManifestTest : public ExtensionManifestTest { |
| 14 virtual void SetUp() OVERRIDE { | 14 virtual void SetUp() OVERRIDE { |
| 15 ExtensionManifestTest::SetUp(); | 15 ExtensionManifestTest::SetUp(); |
| 16 extensions::ManifestHandler::Register(extension_manifest_keys::kOptionsPage, | 16 extensions::ManifestHandler::Register( |
| 17 new extensions::OptionsPageHandler); | 17 extension_manifest_keys::kOptionsPage, |
| 18 make_linked_ptr(new extensions::OptionsPageHandler)); |
| 18 } | 19 } |
| 19 }; | 20 }; |
| 20 | 21 |
| 21 TEST_F(OptionsPageManifestTest, OptionsPageInApps) { | 22 TEST_F(OptionsPageManifestTest, OptionsPageInApps) { |
| 22 scoped_refptr<extensions::Extension> extension; | 23 scoped_refptr<extensions::Extension> extension; |
| 23 | 24 |
| 24 // Allow options page with absolute URL in hosted apps. | 25 // Allow options page with absolute URL in hosted apps. |
| 25 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); | 26 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); |
| 26 EXPECT_STREQ( | 27 EXPECT_STREQ( |
| 27 "http", | 28 "http", |
| (...skipping 15 matching lines...) Expand all Loading... |
| 43 Testcase("hosted_app_file_options.json", | 44 Testcase("hosted_app_file_options.json", |
| 44 errors::kInvalidOptionsPageInHostedApp), | 45 errors::kInvalidOptionsPageInHostedApp), |
| 45 | 46 |
| 46 // Forbid absolute URL for options page in packaged apps. | 47 // Forbid absolute URL for options page in packaged apps. |
| 47 Testcase("packaged_app_absolute_options.json", | 48 Testcase("packaged_app_absolute_options.json", |
| 48 errors::kInvalidOptionsPageExpectUrlInPackage) | 49 errors::kInvalidOptionsPageExpectUrlInPackage) |
| 49 }; | 50 }; |
| 50 RunTestcases(testcases, arraysize(testcases), | 51 RunTestcases(testcases, arraysize(testcases), |
| 51 EXPECT_TYPE_ERROR); | 52 EXPECT_TYPE_ERROR); |
| 52 } | 53 } |
| OLD | NEW |