Index: chrome/common/extensions/extension_manifests_unittest.cc |
=================================================================== |
--- chrome/common/extensions/extension_manifests_unittest.cc (revision 81212) |
+++ chrome/common/extensions/extension_manifests_unittest.cc (working copy) |
@@ -16,6 +16,8 @@ |
#include "chrome/common/extensions/extension_constants.h" |
#include "chrome/common/extensions/extension_error_utils.h" |
#include "chrome/common/extensions/extension_sidebar_defaults.h" |
+#include "chrome/common/extensions/file_browser_action.h" |
+#include "chrome/common/extensions/url_pattern.h" |
#include "chrome/common/json_value_serializer.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -566,3 +568,38 @@ |
EXPECT_TRUE(extension2->is_storage_isolated()); |
*CommandLine::ForCurrentProcess() = old_command_line; |
} |
+ |
+ |
+TEST_F(ExtensionManifestTest, FileBrowserActions) { |
+ LoadAndExpectError("filebrowser_invalid_actions_1.json", |
+ errors::kInvalidFileBrowserAction); |
+ LoadAndExpectError("filebrowser_invalid_actions_2.json", |
+ errors::kInvalidFileBrowserAction); |
+ LoadAndExpectError("filebrowser_invalid_action_id.json", |
+ errors::kInvalidPageActionId); |
+ LoadAndExpectError("filebrowser_invalid_action_title.json", |
+ errors::kInvalidPageActionDefaultTitle); |
+ LoadAndExpectError("filebrowser_invalid_action_id.json", |
+ errors::kInvalidPageActionId); |
+ LoadAndExpectError("filebrowser_invalid_file_filters_1.json", |
+ errors::kInvalidFileFiltersList); |
+ LoadAndExpectError("filebrowser_invalid_file_filters_2.json", |
+ ExtensionErrorUtils::FormatErrorMessage( |
+ errors::kInvalidFileFilterValue, base::IntToString(0))); |
+ LoadAndExpectError("filebrowser_invalid_file_filters_url.json", |
+ ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidURLPatternError, |
+ "http:*.html")); |
+ |
+ scoped_refptr<Extension> extension( |
+ LoadAndExpectSuccess("filebrowser_valid.json")); |
+ ASSERT_TRUE(extension->file_browser_actions() != NULL); |
+ ASSERT_EQ(extension->file_browser_actions()->size(), 1U); |
+ const FileBrowserAction* action = |
+ extension->file_browser_actions()->at(0).get(); |
+ EXPECT_EQ(action->default_title(), "Default title"); |
+ EXPECT_EQ(action->default_icon_path(), "icon.png"); |
+ const FileBrowserAction::PatternList& patterns = action->patterns(); |
+ ASSERT_EQ(patterns.size(), 1U); |
+ ASSERT_TRUE(action->ContainsURL( |
+ GURL("filesystem:chrome-extension://foo/local/test.txt"))); |
+} |