summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorcira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 18:02:47 +0000
committercira@chromium.org <cira@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 18:02:47 +0000
commit9428edc493bf5097cc74fca5fcaf4506c4068668 (patch)
treea5db8e196a4e71c71d54ded4c552b2a4d8c50361 /chrome/test
parentecc73b2f562a20611804cc07dcff59922dbd09b4 (diff)
downloadchromium_src-9428edc493bf5097cc74fca5fcaf4506c4068668.zip
chromium_src-9428edc493bf5097cc74fca5fcaf4506c4068668.tar.gz
chromium_src-9428edc493bf5097cc74fca5fcaf4506c4068668.tar.bz2
Parse messages.json in ExtensionUnpacker (like we do for manifest) and pass them to sandboxed_extension_unpacker.
Added unittest files for unpacker and sandboxed unpacker. TEST=Try loading any of the unpacker samples added in this CL. They should either pass, or show error and fail. BUG=27362 Review URL: http://codereview.chromium.org/390019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/extensions/unpacker/empty_default_locale.crxbin0 -> 521 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/empty_default_locale/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/good_l10n.crxbin0 -> 1185 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/good_l10n/_locales/en_US/messages.json5
-rw-r--r--chrome/test/data/extensions/unpacker/good_l10n/_locales/sr/messages.json5
-rw-r--r--chrome/test/data/extensions/unpacker/good_l10n/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/has_default_missing_locales.crxbin0 -> 539 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/has_default_missing_locales/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/invalid_default_locale.crxbin0 -> 542 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/invalid_default_locale/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/invalid_messages_file.crxbin0 -> 911 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/invalid_messages_file/_locales/en_US/messages.json3
-rw-r--r--chrome/test/data/extensions/unpacker/invalid_messages_file/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/missing_default_data.crxbin0 -> 924 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/missing_default_data/_locales/en_US/messages.json5
-rw-r--r--chrome/test/data/extensions/unpacker/missing_default_data/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/missing_default_has_locales.crxbin0 -> 634 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/missing_default_has_locales/manifest.json5
-rw-r--r--chrome/test/data/extensions/unpacker/missing_messages_file.crxbin0 -> 748 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/missing_messages_file/manifest.json6
-rw-r--r--chrome/test/data/extensions/unpacker/no_l10n.crxbin0 -> 513 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/no_l10n/manifest.json5
-rw-r--r--chrome/test/data/extensions/unpacker/no_locale_data.crxbin0 -> 620 bytes
-rw-r--r--chrome/test/data/extensions/unpacker/no_locale_data/manifest.json6
24 files changed, 76 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/unpacker/empty_default_locale.crx b/chrome/test/data/extensions/unpacker/empty_default_locale.crx
new file mode 100644
index 0000000..d8f1e0e
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/empty_default_locale.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/empty_default_locale/manifest.json b/chrome/test/data/extensions/unpacker/empty_default_locale/manifest.json
new file mode 100644
index 0000000..6f43cf2
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/empty_default_locale/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "Default locale can't be empty",
+ "name": "empty_default_locale",
+ "default_locale": "",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/good_l10n.crx b/chrome/test/data/extensions/unpacker/good_l10n.crx
new file mode 100644
index 0000000..ee56569
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/good_l10n.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/good_l10n/_locales/en_US/messages.json b/chrome/test/data/extensions/unpacker/good_l10n/_locales/en_US/messages.json
new file mode 100644
index 0000000..b5b53c6
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/good_l10n/_locales/en_US/messages.json
@@ -0,0 +1,5 @@
+{
+ "eh": {
+ "message": "this is valid catalog"
+ }
+}
diff --git a/chrome/test/data/extensions/unpacker/good_l10n/_locales/sr/messages.json b/chrome/test/data/extensions/unpacker/good_l10n/_locales/sr/messages.json
new file mode 100644
index 0000000..b5b53c6
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/good_l10n/_locales/sr/messages.json
@@ -0,0 +1,5 @@
+{
+ "eh": {
+ "message": "this is valid catalog"
+ }
+}
diff --git a/chrome/test/data/extensions/unpacker/good_l10n/manifest.json b/chrome/test/data/extensions/unpacker/good_l10n/manifest.json
new file mode 100644
index 0000000..cf2e2a9
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/good_l10n/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "All is well",
+ "name": "good_l10n",
+ "default_locale": "sr",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/has_default_missing_locales.crx b/chrome/test/data/extensions/unpacker/has_default_missing_locales.crx
new file mode 100644
index 0000000..8d2808e
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/has_default_missing_locales.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/has_default_missing_locales/manifest.json b/chrome/test/data/extensions/unpacker/has_default_missing_locales/manifest.json
new file mode 100644
index 0000000..e572fc2
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/has_default_missing_locales/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "Cannot have default_locale but skip _locales",
+ "name": "has_default_missing_locales",
+ "default_locale": "en_US",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/invalid_default_locale.crx b/chrome/test/data/extensions/unpacker/invalid_default_locale.crx
new file mode 100644
index 0000000..8a426c9
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/invalid_default_locale.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/invalid_default_locale/manifest.json b/chrome/test/data/extensions/unpacker/invalid_default_locale/manifest.json
new file mode 100644
index 0000000..ecf7d82
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/invalid_default_locale/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "Default locale has to be string and can't be empty",
+ "name": "invalid_default_locale",
+ "default_locale": 5,
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/invalid_messages_file.crx b/chrome/test/data/extensions/unpacker/invalid_messages_file.crx
new file mode 100644
index 0000000..15691d4
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/invalid_messages_file.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/invalid_messages_file/_locales/en_US/messages.json b/chrome/test/data/extensions/unpacker/invalid_messages_file/_locales/en_US/messages.json
new file mode 100644
index 0000000..a992f8f
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/invalid_messages_file/_locales/en_US/messages.json
@@ -0,0 +1,3 @@
+{
+ "eh:
+}
diff --git a/chrome/test/data/extensions/unpacker/invalid_messages_file/manifest.json b/chrome/test/data/extensions/unpacker/invalid_messages_file/manifest.json
new file mode 100644
index 0000000..7a4b9ef
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/invalid_messages_file/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "Fail if messages.json is not valid (check JSON syntax only)",
+ "name": "invalid_messages_file",
+ "default_locale": "en_US",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/missing_default_data.crx b/chrome/test/data/extensions/unpacker/missing_default_data.crx
new file mode 100644
index 0000000..eeb76fe
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_default_data.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/missing_default_data/_locales/en_US/messages.json b/chrome/test/data/extensions/unpacker/missing_default_data/_locales/en_US/messages.json
new file mode 100644
index 0000000..b5b53c6
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_default_data/_locales/en_US/messages.json
@@ -0,0 +1,5 @@
+{
+ "eh": {
+ "message": "this is valid catalog"
+ }
+}
diff --git a/chrome/test/data/extensions/unpacker/missing_default_data/manifest.json b/chrome/test/data/extensions/unpacker/missing_default_data/manifest.json
new file mode 100644
index 0000000..03ecc4a
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_default_data/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "Data for default_locale has to be present",
+ "name": "missing_default_data",
+ "default_locale": "sr",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/missing_default_has_locales.crx b/chrome/test/data/extensions/unpacker/missing_default_has_locales.crx
new file mode 100644
index 0000000..0bf345d
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_default_has_locales.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/missing_default_has_locales/manifest.json b/chrome/test/data/extensions/unpacker/missing_default_has_locales/manifest.json
new file mode 100644
index 0000000..13a5d4b
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_default_has_locales/manifest.json
@@ -0,0 +1,5 @@
+{
+ "description": "If _locales is present, default_locale has to be defined too.",
+ "name": "missing_default_has_locales",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/missing_messages_file.crx b/chrome/test/data/extensions/unpacker/missing_messages_file.crx
new file mode 100644
index 0000000..4ca3634
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_messages_file.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/missing_messages_file/manifest.json b/chrome/test/data/extensions/unpacker/missing_messages_file/manifest.json
new file mode 100644
index 0000000..a3ccf4b
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/missing_messages_file/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "Each locale has to have messages.json file",
+ "name": "missing_messages_file",
+ "default_locale": "en_US",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/no_l10n.crx b/chrome/test/data/extensions/unpacker/no_l10n.crx
new file mode 100644
index 0000000..d9edd9e
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/no_l10n.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/no_l10n/manifest.json b/chrome/test/data/extensions/unpacker/no_l10n/manifest.json
new file mode 100644
index 0000000..8ba809f
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/no_l10n/manifest.json
@@ -0,0 +1,5 @@
+{
+ "description": "This extension is not localized.",
+ "name": "no_l10n",
+ "version": "1.0"
+}
diff --git a/chrome/test/data/extensions/unpacker/no_locale_data.crx b/chrome/test/data/extensions/unpacker/no_locale_data.crx
new file mode 100644
index 0000000..30a8f40
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/no_locale_data.crx
Binary files differ
diff --git a/chrome/test/data/extensions/unpacker/no_locale_data/manifest.json b/chrome/test/data/extensions/unpacker/no_locale_data/manifest.json
new file mode 100644
index 0000000..c4d68b4
--- /dev/null
+++ b/chrome/test/data/extensions/unpacker/no_locale_data/manifest.json
@@ -0,0 +1,6 @@
+{
+ "description": "_locales can't be empty",
+ "name": "no_locale_data",
+ "default_locale": "en_US",
+ "version": "1.0"
+}