| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/common/extensions/extension.h" |
| 6 | 6 |
| 7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 ExtensionErrorUtils::FormatErrorMessage( | 593 ExtensionErrorUtils::FormatErrorMessage( |
| 594 errors::kHostedAppsCannotIncludeExtensionFeatures, | 594 errors::kHostedAppsCannotIncludeExtensionFeatures, |
| 595 keys::kBrowserAction)); | 595 keys::kBrowserAction)); |
| 596 LoadAndExpectError("disallow_hybrid_2.json", | 596 LoadAndExpectError("disallow_hybrid_2.json", |
| 597 errors::kBackgroundPermissionNeeded); | 597 errors::kBackgroundPermissionNeeded); |
| 598 } | 598 } |
| 599 | 599 |
| 600 TEST_F(ExtensionManifestTest, OptionsPageInApps) { | 600 TEST_F(ExtensionManifestTest, OptionsPageInApps) { |
| 601 scoped_refptr<Extension> extension; | 601 scoped_refptr<Extension> extension; |
| 602 | 602 |
| 603 // Allow options page with absolute URL in hosed apps. | 603 // Allow options page with absolute URL in hosted apps. |
| 604 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); | 604 extension = LoadAndExpectSuccess("hosted_app_absolute_options.json"); |
| 605 EXPECT_STREQ("http", | 605 EXPECT_STREQ("http", |
| 606 extension->options_url().scheme().c_str()); | 606 extension->options_url().scheme().c_str()); |
| 607 EXPECT_STREQ("example.com", | 607 EXPECT_STREQ("example.com", |
| 608 extension->options_url().host().c_str()); | 608 extension->options_url().host().c_str()); |
| 609 EXPECT_STREQ("options.html", | 609 EXPECT_STREQ("options.html", |
| 610 extension->options_url().ExtractFileName().c_str()); | 610 extension->options_url().ExtractFileName().c_str()); |
| 611 | 611 |
| 612 // Forbid options page with relative URL in hosted apps. | 612 // Forbid options page with relative URL in hosted apps. |
| 613 LoadAndExpectError("hosted_app_relative_options.json", | 613 LoadAndExpectError("hosted_app_relative_options.json", |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 #if defined(FILE_MANAGER_EXTENSION) | 819 #if defined(FILE_MANAGER_EXTENSION) |
| 820 EXPECT_EQ("", error); | 820 EXPECT_EQ("", error); |
| 821 #else | 821 #else |
| 822 EXPECT_EQ(errors::kInvalidChromeURLOverrides, error); | 822 EXPECT_EQ(errors::kInvalidChromeURLOverrides, error); |
| 823 #endif | 823 #endif |
| 824 | 824 |
| 825 // Extensions of other types can't ovverride chrome://files/ URL. | 825 // Extensions of other types can't ovverride chrome://files/ URL. |
| 826 LoadAndExpectError("filebrowser_url_override.json", | 826 LoadAndExpectError("filebrowser_url_override.json", |
| 827 errors::kInvalidChromeURLOverrides); | 827 errors::kInvalidChromeURLOverrides); |
| 828 } | 828 } |
| 829 |
| 830 TEST_F(ExtensionManifestTest, OfflineEnabled) { |
| 831 LoadAndExpectError("offline_enabled_invalid.json", |
| 832 errors::kInvalidOfflineEnabled); |
| 833 scoped_refptr<Extension> extension_0( |
| 834 LoadAndExpectSuccess("offline_enabled_extension.json")); |
| 835 EXPECT_TRUE(extension_0->offline_enabled()); |
| 836 scoped_refptr<Extension> extension_1( |
| 837 LoadAndExpectSuccess("offline_enabled_packaged_app.json")); |
| 838 EXPECT_TRUE(extension_1->offline_enabled()); |
| 839 scoped_refptr<Extension> extension_2( |
| 840 LoadAndExpectSuccess("offline_disabled_packaged_app.json")); |
| 841 EXPECT_FALSE(extension_2->offline_enabled()); |
| 842 scoped_refptr<Extension> extension_3( |
| 843 LoadAndExpectSuccess("offline_default_packaged_app.json")); |
| 844 EXPECT_FALSE(extension_3->offline_enabled()); |
| 845 scoped_refptr<Extension> extension_4( |
| 846 LoadAndExpectSuccess("offline_enabled_hosted_app.json")); |
| 847 EXPECT_TRUE(extension_4->offline_enabled()); |
| 848 } |
| OLD | NEW |