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

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
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")));
+}

Powered by Google App Engine
This is Rietveld 408576698