Beispiel #1
0
    def test_jetpack_core(self):
        # this has a side-effect of asserting that all the SDK's api-utils
        # modules are clean.
        jp_core = "packages/api-utils/lib"
        assert os.path.isdir(jp_core)  # we expect to be run from the SDK top
        stderr = StringIO()
        manifest, has_problems = scan_package("prefix-", "resource:foo/", "api-utils", "lib", jp_core, stderr)
        stderr.seek(0)
        err = stderr.readlines()
        self.failUnlessEqual(err, [], "".join(err))
        self.failUnlessEqual(has_problems, False)
        update_manifest_with_fileinfo(["api-utils"], "api-utils", manifest)

        # look at a few samples from the manifest: this depends upon the
        # behavior of other files in the SDK, so when those files change
        # (specifically when they move or add dependencies), this test must
        # be updated
        self.failUnless("resource:foo/tab-browser.js" in manifest, manifest.keys())
        tb = manifest["resource:foo/tab-browser.js"]
        self.failUnlessEqual(tb.chrome, True)
        self.failUnlessEqual(tb.name, "tab-browser")
        self.failUnlessEqual(tb.packageName, "api-utils")
        self.failUnless("window-utils" in tb.requires, tb.requires.values())
        self.failUnlessEqual(tb.requires["window-utils"].url, "resource:foo/window-utils.js")
        self.failUnlessEqual(tb.sectionName, "lib")
        self.failUnlessEqual(tb.zipname, "resources/prefix-api-utils-lib/tab-browser.js")
        h = tb.hash
        self.failUnless(re.search(r"^[0-9a-f]{64}$", h), h)
        # don't assert the actual value, since that will change each time
        # page-mod.js changes

        self.failUnless("resource:foo/api-utils.js" in manifest, manifest.keys())
Beispiel #2
0
 def test_e10s_adapter(self):
     path = "python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib"
     manifest, has_problems = scan_package("prefix-", "resource:foo/", "foo", "lib", path)
     update_manifest_with_fileinfo(["foo"], "foo", manifest)
     self.assertEqual(manifest["resource:foo/bar.js"]["e10s-adapter"], "resource:foo/bar-e10s-adapter.js")
     self.assertFalse(manifest["resource:foo/bar-e10s-adapter.js"]["e10s-adapter"])
     self.assertFalse(manifest["resource:foo/foo.js"]["e10s-adapter"])
 def test_e10s_adapter(self):
     path = "python-lib/cuddlefish/tests/e10s-adapter-files/packages/foo/lib"
     manifest, has_problems = scan_package("prefix-", "resource:foo/",
                                           "foo", "lib", path)
     update_manifest_with_fileinfo(["foo"], "foo", manifest)
     self.assertEqual(manifest['resource:foo/bar.js']['e10s-adapter'],
                      'resource:foo/bar-e10s-adapter.js')
     self.assertFalse(
         manifest['resource:foo/bar-e10s-adapter.js']['e10s-adapter'])
     self.assertFalse(manifest['resource:foo/foo.js']['e10s-adapter'])
    def test_jetpack_core(self):
        # this has a side-effect of asserting that all the SDK's api-utils
        # modules are clean.
        jp_core = "packages/api-utils/lib"
        assert os.path.isdir(jp_core)  # we expect to be run from the SDK top
        stderr = StringIO()
        manifest, has_problems = scan_package("prefix-", "resource:foo/",
                                              "api-utils", "lib", jp_core,
                                              stderr)
        stderr.seek(0)
        err = stderr.readlines()
        self.failUnlessEqual(err, [], "".join(err))
        self.failUnlessEqual(has_problems, False)
        update_manifest_with_fileinfo(["api-utils"], "api-utils", manifest)

        # look at a few samples from the manifest: this depends upon the
        # behavior of other files in the SDK, so when those files change
        # (specifically when they move or add dependencies), this test must
        # be updated
        self.failUnless("resource:foo/tab-browser.js" in manifest,
                        manifest.keys())
        tb = manifest["resource:foo/tab-browser.js"]
        self.failUnlessEqual(tb.chrome, True)
        self.failUnlessEqual(tb.name, "tab-browser")
        self.failUnlessEqual(tb.packageName, "api-utils")
        self.failUnless("window-utils" in tb.requires, tb.requires.values())
        self.failUnlessEqual(tb.requires["window-utils"].url,
                             "resource:foo/window-utils.js")
        self.failUnlessEqual(tb.sectionName, "lib")
        self.failUnlessEqual(tb.zipname,
                             "resources/prefix-api-utils-lib/tab-browser.js")
        h = tb.hash
        self.failUnless(re.search(r'^[0-9a-f]{64}$', h), h)
        # don't assert the actual value, since that will change each time
        # page-mod.js changes

        self.failUnless("resource:foo/api-utils.js" in manifest,
                        manifest.keys())