# Path: validator/decorator.py
# TEST_TIERS = {}
# CLEANUP_FUNCTIONS = []
# def register_test(tier=1, expected_type=None, simple=False, versions=None):
#     def wrap(function):
# def register_cleanup(cleanup):
# def cleanup():
# def get_tiers():
# def get_tests(tier, type_=None):
# def version_range(guid, version, before=None, app_versions=None):
# 
# Path: validator/submain.py
# def prepare_package(err, path, expectation=0, for_appversions=None,
#                     timeout=-1):
#         def timeout_handler(signum, frame):
# def test_search(err, package, expectation=0):
# def test_package(err, file_, name, expectation=PACKAGE_ANY,
#                  for_appversions=None):
# def _load_install_rdf(err, package, expectation):
# def _load_package_json(err, package, expectation):
# def _load_manifest_json(err, package, expectation):
# def populate_chrome_manifest(err, xpi_package):
#         def get_linked_manifest(path, from_path, from_chrome, from_triple):
# def test_inner_package(err, xpi_package, for_appversions=None):
# 
# Path: validator/unicodehelper.py
# UNICODE_BOMS = [
#     (codecs.BOM_UTF8, 'utf-8'),
#     (codecs.BOM_UTF32_LE, 'utf-32-le'),
#     (codecs.BOM_UTF32_BE, 'utf-32-be'),
#     (codecs.BOM_UTF16_LE, 'utf-16-le'),
#     (codecs.BOM_UTF16_BE, 'utf-16-be'),
# ]
# COMMON_ENCODINGS = ('latin_1', 'utf-16')
# NON_ASCII_FILTER = re.compile(r'[^\t\r\n\x20-\x7f]+')
# def decode(data):


import hashlib
import os
import re
import validator.testcases.markup.markuptester as testendpoint_markup
import validator.testcases.markup.csstester as testendpoint_css
import validator.testcases.scripting as testendpoint_js
import validator.testcases.langpack as testendpoint_langpack
from StringIO import StringIO
from zipfile import BadZipfile
from regex import run_regex_tests
from validator.constants import MAX_JS_THRESHOLD
from validator import decorator
from validator import submain as testendpoint_validator
from validator import unicodehelper
from validator.constants import (BUGZILLA_BUG, PACKAGE_LANGPACK,
                                 PACKAGE_SUBPACKAGE, PACKAGE_THEME)
from validator.xpi import XPIManager
            # If the file is processed, it will return True. If the process
            # goes badly, it will return False. If the processing is skipped,
            # it returns None. We should respect that.
            if processed is None:
                continue

        # This is tested in test_langpack.py
        if err.detected_type == PACKAGE_LANGPACK and not processed:
            testendpoint_langpack.test_unsafe_html(err, name, file_data)

        # This aids in creating unit tests.
        processed_files += 1

    # If there aren't any scripts in the package, just skip the next few bits.
    if not scripts:
        return processed_files

    # Save the list of scripts, along with where to find them and the current
    # validation state.
    existing_scripts = err.get_resource('scripts')
    if not existing_scripts:
        existing_scripts = []
    existing_scripts.append({'scripts': scripts,
                             'package': xpi_package,
                             'state': err.package_stack[:]})
    err.save_resource('scripts', existing_scripts)

    return processed_files



# Path: validator/decorator.py
# TEST_TIERS = {}
# CLEANUP_FUNCTIONS = []
# def register_test(tier=1, expected_type=None, simple=False, versions=None):
#     def wrap(function):
# def register_cleanup(cleanup):
# def cleanup():
# def get_tiers():
# def get_tests(tier, type_=None):
# def version_range(guid, version, before=None, app_versions=None):
# 
# Path: validator/submain.py
# def prepare_package(err, path, expectation=0, for_appversions=None,
#                     timeout=-1):
#         def timeout_handler(signum, frame):
# def test_search(err, package, expectation=0):
# def test_package(err, file_, name, expectation=PACKAGE_ANY,
#                  for_appversions=None):
# def _load_install_rdf(err, package, expectation):
# def _load_package_json(err, package, expectation):
# def _load_manifest_json(err, package, expectation):
# def populate_chrome_manifest(err, xpi_package):
#         def get_linked_manifest(path, from_path, from_chrome, from_triple):
# def test_inner_package(err, xpi_package, for_appversions=None):
# 
# Path: validator/unicodehelper.py
# UNICODE_BOMS = [
#     (codecs.BOM_UTF8, 'utf-8'),
#     (codecs.BOM_UTF32_LE, 'utf-32-le'),
#     (codecs.BOM_UTF32_BE, 'utf-32-be'),
#     (codecs.BOM_UTF16_LE, 'utf-16-le'),
#     (codecs.BOM_UTF16_BE, 'utf-16-be'),
# ]
# COMMON_ENCODINGS = ('latin_1', 'utf-16')
# NON_ASCII_FILTER = re.compile(r'[^\t\r\n\x20-\x7f]+')
# def decode(data):


# Path: validator/testcases/content.py
import hashlib
import os
import re
import validator.testcases.markup.markuptester as testendpoint_markup
import validator.testcases.markup.csstester as testendpoint_css
import validator.testcases.scripting as testendpoint_js
import validator.testcases.langpack as testendpoint_langpack
from StringIO import StringIO
from zipfile import BadZipfile
from regex import run_regex_tests
from validator.constants import MAX_JS_THRESHOLD
from validator import decorator
from validator import submain as testendpoint_validator
from validator import unicodehelper
from validator.constants import (BUGZILLA_BUG, PACKAGE_LANGPACK,
                                 PACKAGE_SUBPACKAGE, PACKAGE_THEME)
from validator.xpi import XPIManager

            # If the file is processed, it will return True. If the process
            # goes badly, it will return False. If the processing is skipped,
            # it returns None. We should respect that.
            if processed is None:
                continue

        # This is tested in test_langpack.py
        if err.detected_type == PACKAGE_LANGPACK and not processed:
            testendpoint_langpack.test_unsafe_html(err, name, file_data)

        # This aids in creating unit tests.
        processed_files += 1

    # If there aren't any scripts in the package, just skip the next few bits.
    if not scripts:
        return processed_files

    # Save the list of scripts, along with where to find them and the current
    # validation state.
    existing_scripts = err.get_resource('scripts')
    if not existing_scripts:
        existing_scripts = []
    existing_scripts.append({'scripts': scripts,
                             'package': xpi_package,
                             'state': err.package_stack[:]})
    err.save_resource('scripts', existing_scripts)

    return processed_files



@decorator.register_test(tier=3)