Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2269)

Unified Diff: chrome/common/extensions/extension_manifests_unittest.cc

Issue 6749021: Added new fileBrowserPrivate and fileHandler extension APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension_manifests_unittest.cc
===================================================================
--- chrome/common/extensions/extension_manifests_unittest.cc (revision 81868)
+++ 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_handler.h"
+#include "chrome/common/extensions/url_pattern.h"
#include "content/common/json_value_serializer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -568,3 +570,38 @@
EXPECT_TRUE(extension2->is_storage_isolated());
*CommandLine::ForCurrentProcess() = old_command_line;
}
+
+
+TEST_F(ExtensionManifestTest, FileBrowserHandlers) {
+ LoadAndExpectError("filebrowser_invalid_actions_1.json",
+ errors::kInvalidFileBrowserHandler);
+ LoadAndExpectError("filebrowser_invalid_actions_2.json",
+ errors::kInvalidFileBrowserHandler);
+ 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_handlers() != NULL);
+ ASSERT_EQ(extension->file_browser_handlers()->size(), 1U);
+ const FileBrowserHandler* action =
+ extension->file_browser_handlers()->at(0).get();
+ EXPECT_EQ(action->title(), "Default title");
+ EXPECT_EQ(action->icon_path(), "icon.png");
+ const FileBrowserHandler::PatternList& patterns = action->file_url_patterns();
+ ASSERT_EQ(patterns.size(), 1U);
+ ASSERT_TRUE(action->MatchesURL(
+ GURL("filesystem:chrome-extension://foo/local/test.txt")));
+}
« no previous file with comments | « chrome/common/extensions/extension_constants.cc ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698