summaryrefslogtreecommitdiffstats
path: root/extensions/test/data
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/test/data')
-rw-r--r--extensions/test/data/unpacker/bad_image.crxbin0 -> 1243 bytes
-rw-r--r--extensions/test/data/unpacker/bad_image/background.js5
-rw-r--r--extensions/test/data/unpacker/bad_image/manifest.json7
-rw-r--r--extensions/test/data/unpacker/bad_image/not_really_an_image.png1
-rw-r--r--extensions/test/data/unpacker/bad_zip.crxbin0 -> 8498 bytes
-rw-r--r--extensions/test/data/unpacker/bad_zip/background.js5
-rw-r--r--extensions/test/data/unpacker/bad_zip/bad_zip.pem16
-rwxr-xr-xextensions/test/data/unpacker/bad_zip/bad_zip.sh41
-rw-r--r--extensions/test/data/unpacker/bad_zip/manifest.json9
-rw-r--r--extensions/test/data/unpacker/bad_zip/product_logo_128.pngbin0 -> 10100 bytes
-rw-r--r--extensions/test/data/unpacker/empty_default_locale.crxbin0 -> 521 bytes
-rw-r--r--extensions/test/data/unpacker/empty_default_locale/manifest.json6
-rw-r--r--extensions/test/data/unpacker/good_l10n.crxbin0 -> 1185 bytes
-rw-r--r--extensions/test/data/unpacker/good_l10n/_locales/en_US/messages.json5
-rw-r--r--extensions/test/data/unpacker/good_l10n/_locales/sr/messages.json5
-rw-r--r--extensions/test/data/unpacker/good_l10n/manifest.json6
-rw-r--r--extensions/test/data/unpacker/good_package.crxbin0 -> 11054 bytes
-rw-r--r--extensions/test/data/unpacker/good_package/manifest.json9
-rw-r--r--extensions/test/data/unpacker/good_package/product_logo_128.pngbin0 -> 10100 bytes
-rw-r--r--extensions/test/data/unpacker/has_default_missing_locales.crxbin0 -> 539 bytes
-rw-r--r--extensions/test/data/unpacker/has_default_missing_locales/manifest.json6
-rw-r--r--extensions/test/data/unpacker/invalid_default_locale.crxbin0 -> 542 bytes
-rw-r--r--extensions/test/data/unpacker/invalid_default_locale/manifest.json6
-rw-r--r--extensions/test/data/unpacker/invalid_messages_file.crxbin0 -> 911 bytes
-rw-r--r--extensions/test/data/unpacker/invalid_messages_file/_locales/en_US/messages.json3
-rw-r--r--extensions/test/data/unpacker/invalid_messages_file/manifest.json6
-rw-r--r--extensions/test/data/unpacker/missing_default_data.crxbin0 -> 924 bytes
-rw-r--r--extensions/test/data/unpacker/missing_default_data/_locales/en_US/messages.json5
-rw-r--r--extensions/test/data/unpacker/missing_default_data/manifest.json6
-rw-r--r--extensions/test/data/unpacker/missing_default_has_locales.crxbin0 -> 634 bytes
-rw-r--r--extensions/test/data/unpacker/missing_default_has_locales/manifest.json5
-rw-r--r--extensions/test/data/unpacker/missing_messages_file.crxbin0 -> 748 bytes
-rw-r--r--extensions/test/data/unpacker/missing_messages_file/manifest.json6
-rw-r--r--extensions/test/data/unpacker/no_l10n.crxbin0 -> 513 bytes
-rw-r--r--extensions/test/data/unpacker/no_l10n/manifest.json5
-rw-r--r--extensions/test/data/unpacker/no_locale_data.crxbin0 -> 620 bytes
-rw-r--r--extensions/test/data/unpacker/no_locale_data/manifest.json6
37 files changed, 169 insertions, 0 deletions
diff --git a/extensions/test/data/unpacker/bad_image.crx b/extensions/test/data/unpacker/bad_image.crx
new file mode 100644
index 0000000..192bd09
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_image.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/bad_image/background.js b/extensions/test/data/unpacker/bad_image/background.js
new file mode 100644
index 0000000..8c00bb1
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_image/background.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Not doing anything.
diff --git a/extensions/test/data/unpacker/bad_image/manifest.json b/extensions/test/data/unpacker/bad_image/manifest.json
new file mode 100644
index 0000000..9048606
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_image/manifest.json
@@ -0,0 +1,7 @@
+{
+ "name": "Bad Image",
+ "version": "1.0",
+ "manifest_version": 2,
+ "description": "Package with a bad image to be used for unit testing.",
+ "icons": { "128": "not_really_an_image.png" }
+}
diff --git a/extensions/test/data/unpacker/bad_image/not_really_an_image.png b/extensions/test/data/unpacker/bad_image/not_really_an_image.png
new file mode 100644
index 0000000..9516805
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_image/not_really_an_image.png
@@ -0,0 +1 @@
+Thu Aug 23 09:01:45 PDT 2012
diff --git a/extensions/test/data/unpacker/bad_zip.crx b/extensions/test/data/unpacker/bad_zip.crx
new file mode 100644
index 0000000..3bd8ed7
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_zip.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/bad_zip/background.js b/extensions/test/data/unpacker/bad_zip/background.js
new file mode 100644
index 0000000..8c00bb1
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_zip/background.js
@@ -0,0 +1,5 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Not doing anything.
diff --git a/extensions/test/data/unpacker/bad_zip/bad_zip.pem b/extensions/test/data/unpacker/bad_zip/bad_zip.pem
new file mode 100644
index 0000000..0599802
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_zip/bad_zip.pem
@@ -0,0 +1,16 @@
+-----BEGIN PRIVATE KEY-----
+MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOjf84gztCkAgocAh
+eFUD1ktpLIVH8IjUFjLQ6P5pB9hAN4sNO/mBH+LC/Q6WDpKN+ei9Shh82NbLlKeVN
+j8I/hKPjWpGuGjMqYfEl5y1Uq1Z788s6pATT1KYNzXJVy6HBkNYr8iyZsqSIP3zyY
+7VXLfx7gG5CgWUKrLxnGv9/i7AgMBAAECgYAn3WagM1GtDzRJDhLdHvm9p22hOrKE
+Fm2DtdAveuXYpU9zuRea1cKBXvk95tsBp4Doe2ICdromkQ5eAFLADnHNlKiL5camn
+w1L3YhtqAl+lM1IDsDv5cIVQnzis8b6ydUyG8nJ6J3JQuNQ7rCRMVEPV1HEI+FmF3
+CK/SIodZS5SQJBAP11ozwyxml1XF/dGzXAi5Ci3vsNEOa6ZOBo9pzxkRAx3z48hq5
+gfpmBfucdXgGTVXAU+yZvQB+35yURFAdFMNUCQQDrNX6Wvj+PLGptQqcasLJQGrje
+++b8M3bCxj34z9xZKS7m/zU6Y+lp/uf+kLK14oCNCk3xDmIutzG8FgLe0ctPAkB4X
+K7h3XLfjb4KQCO1yPP+AXpGWhQWnZleADpsmUK8IBLVqUSD9oroNtiexBFqSh8elL
+gXrmkTJu/7aDrMoQzpAkAsTyWLzEc494sNDjNgqczNnlsZVqcK9771rlbaWn4OJd3
+6EjW6zDuahjS6FhQ0g3joGPrZ4HXKiyRJZHQh+a+tAkEAmxPXDhummz7bJnfulB1D
+5yk9l/7xfei0/o4uKiHKtg5RbdEQVuQtNKoGDrinN41HtJy6xIlUs0B3uGIDSWddB
+w==
+-----END PRIVATE KEY-----
diff --git a/extensions/test/data/unpacker/bad_zip/bad_zip.sh b/extensions/test/data/unpacker/bad_zip/bad_zip.sh
new file mode 100755
index 0000000..bb147f2
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_zip/bad_zip.sh
@@ -0,0 +1,41 @@
+#!/bin/bash -e
+
+## Copyright (c) 2012 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Purpose: Create a corrupt (invalid ZIP) version of a Chromium crx.
+if test $# -ne 2; then
+ echo "Usage: bad_zip.sh <extension dir> <pem path>"
+ exit 1
+fi
+dir=$1
+key=$2
+name=$(basename "$dir")
+crx="$name.crx"
+pub="$name.pub"
+sig="$name.sig"
+zip="$name.zip"
+trap 'rm -f "$pub" "$sig" "$zip"' EXIT
+# zip up the crx dir
+cwd=$(pwd -P)
+(cd "$dir" && zip -qr -9 -X "$cwd/$zip" .)
+# truncate the zip to 8K so it's invalid
+dd if=$zip of=$zip+ bs=1024 count=8 2>/dev/null && mv $zip+ $zip
+# signature
+openssl sha1 -sha1 -binary -sign "$key" < "$zip" > "$sig"
+# public key
+openssl rsa -pubout -outform DER < "$key" > "$pub" 2>/dev/null
+byte_swap () {
+ # Take "abcdefgh" and return it as "ghefcdab"
+ echo "${1:6:2}${1:4:2}${1:2:2}${1:0:2}"
+}
+crmagic_hex="4372 3234" # Cr24
+version_hex="0200 0000" # 2
+pub_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$pub" | awk '{print $5}')))
+sig_len_hex=$(byte_swap $(printf '%08x\n' $(ls -l "$sig" | awk '{print $5}')))
+(
+ echo "$crmagic_hex $version_hex $pub_len_hex $sig_len_hex" | xxd -r -p
+ cat "$pub" "$sig" "$zip"
+) > "$crx"
+echo "Wrote $crx with invalid ZIP"
diff --git a/extensions/test/data/unpacker/bad_zip/manifest.json b/extensions/test/data/unpacker/bad_zip/manifest.json
new file mode 100644
index 0000000..5bed7ba
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_zip/manifest.json
@@ -0,0 +1,9 @@
+{
+ "name": "Bad ZIP",
+ "manifest_version": 2,
+ "version": "1.0",
+ "description": "Good package to be mangled by bad_zip.sh for unit testing.",
+ "icons": {
+ "128" : "product_logo_128.png"
+ }
+}
diff --git a/extensions/test/data/unpacker/bad_zip/product_logo_128.png b/extensions/test/data/unpacker/bad_zip/product_logo_128.png
new file mode 100644
index 0000000..b70cd25
--- /dev/null
+++ b/extensions/test/data/unpacker/bad_zip/product_logo_128.png
Binary files differ
diff --git a/extensions/test/data/unpacker/empty_default_locale.crx b/extensions/test/data/unpacker/empty_default_locale.crx
new file mode 100644
index 0000000..d8f1e0e
--- /dev/null
+++ b/extensions/test/data/unpacker/empty_default_locale.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/empty_default_locale/manifest.json b/extensions/test/data/unpacker/empty_default_locale/manifest.json
new file mode 100644
index 0000000..6f43cf2
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/good_l10n.crx b/extensions/test/data/unpacker/good_l10n.crx
new file mode 100644
index 0000000..ee56569
--- /dev/null
+++ b/extensions/test/data/unpacker/good_l10n.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/good_l10n/_locales/en_US/messages.json b/extensions/test/data/unpacker/good_l10n/_locales/en_US/messages.json
new file mode 100644
index 0000000..b5b53c6
--- /dev/null
+++ b/extensions/test/data/unpacker/good_l10n/_locales/en_US/messages.json
@@ -0,0 +1,5 @@
+{
+ "eh": {
+ "message": "this is valid catalog"
+ }
+}
diff --git a/extensions/test/data/unpacker/good_l10n/_locales/sr/messages.json b/extensions/test/data/unpacker/good_l10n/_locales/sr/messages.json
new file mode 100644
index 0000000..b5b53c6
--- /dev/null
+++ b/extensions/test/data/unpacker/good_l10n/_locales/sr/messages.json
@@ -0,0 +1,5 @@
+{
+ "eh": {
+ "message": "this is valid catalog"
+ }
+}
diff --git a/extensions/test/data/unpacker/good_l10n/manifest.json b/extensions/test/data/unpacker/good_l10n/manifest.json
new file mode 100644
index 0000000..cf2e2a9
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/good_package.crx b/extensions/test/data/unpacker/good_package.crx
new file mode 100644
index 0000000..c77e191
--- /dev/null
+++ b/extensions/test/data/unpacker/good_package.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/good_package/manifest.json b/extensions/test/data/unpacker/good_package/manifest.json
new file mode 100644
index 0000000..f1aa747
--- /dev/null
+++ b/extensions/test/data/unpacker/good_package/manifest.json
@@ -0,0 +1,9 @@
+{
+ "name": "Good Package",
+ "manifest_version": 2,
+ "version": "1.0",
+ "description": "Good (valid) package to be used for unit testing.",
+ "icons": {
+ "128": "product_logo_128.png"
+ }
+}
diff --git a/extensions/test/data/unpacker/good_package/product_logo_128.png b/extensions/test/data/unpacker/good_package/product_logo_128.png
new file mode 100644
index 0000000..b70cd25
--- /dev/null
+++ b/extensions/test/data/unpacker/good_package/product_logo_128.png
Binary files differ
diff --git a/extensions/test/data/unpacker/has_default_missing_locales.crx b/extensions/test/data/unpacker/has_default_missing_locales.crx
new file mode 100644
index 0000000..8d2808e
--- /dev/null
+++ b/extensions/test/data/unpacker/has_default_missing_locales.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/has_default_missing_locales/manifest.json b/extensions/test/data/unpacker/has_default_missing_locales/manifest.json
new file mode 100644
index 0000000..e572fc2
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/invalid_default_locale.crx b/extensions/test/data/unpacker/invalid_default_locale.crx
new file mode 100644
index 0000000..8a426c9
--- /dev/null
+++ b/extensions/test/data/unpacker/invalid_default_locale.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/invalid_default_locale/manifest.json b/extensions/test/data/unpacker/invalid_default_locale/manifest.json
new file mode 100644
index 0000000..ecf7d82
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/invalid_messages_file.crx b/extensions/test/data/unpacker/invalid_messages_file.crx
new file mode 100644
index 0000000..15691d4
--- /dev/null
+++ b/extensions/test/data/unpacker/invalid_messages_file.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/invalid_messages_file/_locales/en_US/messages.json b/extensions/test/data/unpacker/invalid_messages_file/_locales/en_US/messages.json
new file mode 100644
index 0000000..a992f8f
--- /dev/null
+++ b/extensions/test/data/unpacker/invalid_messages_file/_locales/en_US/messages.json
@@ -0,0 +1,3 @@
+{
+ "eh:
+}
diff --git a/extensions/test/data/unpacker/invalid_messages_file/manifest.json b/extensions/test/data/unpacker/invalid_messages_file/manifest.json
new file mode 100644
index 0000000..7a4b9ef
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/missing_default_data.crx b/extensions/test/data/unpacker/missing_default_data.crx
new file mode 100644
index 0000000..eeb76fe
--- /dev/null
+++ b/extensions/test/data/unpacker/missing_default_data.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/missing_default_data/_locales/en_US/messages.json b/extensions/test/data/unpacker/missing_default_data/_locales/en_US/messages.json
new file mode 100644
index 0000000..b5b53c6
--- /dev/null
+++ b/extensions/test/data/unpacker/missing_default_data/_locales/en_US/messages.json
@@ -0,0 +1,5 @@
+{
+ "eh": {
+ "message": "this is valid catalog"
+ }
+}
diff --git a/extensions/test/data/unpacker/missing_default_data/manifest.json b/extensions/test/data/unpacker/missing_default_data/manifest.json
new file mode 100644
index 0000000..03ecc4a
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/missing_default_has_locales.crx b/extensions/test/data/unpacker/missing_default_has_locales.crx
new file mode 100644
index 0000000..0bf345d
--- /dev/null
+++ b/extensions/test/data/unpacker/missing_default_has_locales.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/missing_default_has_locales/manifest.json b/extensions/test/data/unpacker/missing_default_has_locales/manifest.json
new file mode 100644
index 0000000..13a5d4b
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/missing_messages_file.crx b/extensions/test/data/unpacker/missing_messages_file.crx
new file mode 100644
index 0000000..4ca3634
--- /dev/null
+++ b/extensions/test/data/unpacker/missing_messages_file.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/missing_messages_file/manifest.json b/extensions/test/data/unpacker/missing_messages_file/manifest.json
new file mode 100644
index 0000000..a3ccf4b
--- /dev/null
+++ b/extensions/test/data/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/extensions/test/data/unpacker/no_l10n.crx b/extensions/test/data/unpacker/no_l10n.crx
new file mode 100644
index 0000000..d9edd9e
--- /dev/null
+++ b/extensions/test/data/unpacker/no_l10n.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/no_l10n/manifest.json b/extensions/test/data/unpacker/no_l10n/manifest.json
new file mode 100644
index 0000000..8ba809f
--- /dev/null
+++ b/extensions/test/data/unpacker/no_l10n/manifest.json
@@ -0,0 +1,5 @@
+{
+ "description": "This extension is not localized.",
+ "name": "no_l10n",
+ "version": "1.0"
+}
diff --git a/extensions/test/data/unpacker/no_locale_data.crx b/extensions/test/data/unpacker/no_locale_data.crx
new file mode 100644
index 0000000..30a8f40
--- /dev/null
+++ b/extensions/test/data/unpacker/no_locale_data.crx
Binary files differ
diff --git a/extensions/test/data/unpacker/no_locale_data/manifest.json b/extensions/test/data/unpacker/no_locale_data/manifest.json
new file mode 100644
index 0000000..c4d68b4
--- /dev/null
+++ b/extensions/test/data/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"
+}