def test_manifest_file(self): f = ManifestFile('chrome') f.add(ManifestContent('chrome', 'global', 'toolkit/content/global/')) f.add(ManifestResource('chrome', 'gre-resources', 'toolkit/res/')) f.add( ManifestLocale('chrome', 'browser', 'en-US', 'en-US/locale/browser/')) f.copy(self.tmppath('chrome.manifest')) self.assertEqual( open(self.tmppath('chrome.manifest')).readlines(), [ 'content global toolkit/content/global/\n', 'resource gre-resources toolkit/res/\n', 'locale browser en-US en-US/locale/browser/\n', ]) self.assertRaises( ValueError, f.remove, ManifestContent('', 'global', 'toolkit/content/global/')) self.assertRaises( ValueError, f.remove, ManifestOverride('chrome', 'chrome://global/locale/netError.dtd', 'chrome://browser/locale/netError.dtd')) f.remove(ManifestContent('chrome', 'global', 'toolkit/content/global/')) self.assertRaises( ValueError, f.remove, ManifestContent('chrome', 'global', 'toolkit/content/global/')) f.copy(self.tmppath('chrome.manifest')) content = open(self.tmppath('chrome.manifest')).read() self.assertEqual(content[:42], f.open().read(42)) self.assertEqual(content, f.open().read())
def test_manifest_file(self): f = ManifestFile("chrome") f.add(ManifestContent("chrome", "global", "toolkit/content/global/")) f.add(ManifestResource("chrome", "gre-resources", "toolkit/res/")) f.add(ManifestResource("chrome/pdfjs", "pdfjs", "./")) f.add(ManifestContent("chrome/pdfjs", "pdfjs", "pdfjs")) f.add(ManifestLocale("chrome", "browser", "en-US", "en-US/locale/browser/")) f.copy(self.tmppath("chrome.manifest")) self.assertEqual( open(self.tmppath("chrome.manifest")).readlines(), [ "content global toolkit/content/global/\n", "resource gre-resources toolkit/res/\n", "resource pdfjs pdfjs/\n", "content pdfjs pdfjs/pdfjs\n", "locale browser en-US en-US/locale/browser/\n", ], ) self.assertRaises(ValueError, f.remove, ManifestContent("", "global", "toolkit/content/global/")) self.assertRaises( ValueError, f.remove, ManifestOverride("chrome", "chrome://global/locale/netError.dtd", "chrome://browser/locale/netError.dtd"), ) f.remove(ManifestContent("chrome", "global", "toolkit/content/global/")) self.assertRaises(ValueError, f.remove, ManifestContent("chrome", "global", "toolkit/content/global/")) f.copy(self.tmppath("chrome.manifest")) content = open(self.tmppath("chrome.manifest")).read() self.assertEqual(content[:42], f.open().read(42)) self.assertEqual(content, f.open().read())
def test_manifest_file(self): f = ManifestFile("chrome") f.add(ManifestContent("chrome", "global", "toolkit/content/global/")) f.add(ManifestResource("chrome", "gre-resources", "toolkit/res/")) f.add(ManifestResource("chrome/pdfjs", "pdfjs", "./")) f.add(ManifestContent("chrome/pdfjs", "pdfjs", "pdfjs")) f.add( ManifestLocale("chrome", "browser", "en-US", "en-US/locale/browser/")) f.copy(self.tmppath("chrome.manifest")) self.assertEqual( open(self.tmppath("chrome.manifest")).readlines(), [ "content global toolkit/content/global/\n", "resource gre-resources toolkit/res/\n", "resource pdfjs pdfjs/\n", "content pdfjs pdfjs/pdfjs\n", "locale browser en-US en-US/locale/browser/\n", ], ) self.assertRaises( ValueError, f.remove, ManifestContent("", "global", "toolkit/content/global/"), ) self.assertRaises( ValueError, f.remove, ManifestOverride( "chrome", "chrome://global/locale/netError.dtd", "chrome://browser/locale/netError.dtd", ), ) f.remove(ManifestContent("chrome", "global", "toolkit/content/global/")) self.assertRaises( ValueError, f.remove, ManifestContent("chrome", "global", "toolkit/content/global/"), ) f.copy(self.tmppath("chrome.manifest")) content = open(self.tmppath("chrome.manifest"), "rb").read() self.assertEqual(content[:42], f.open().read(42)) self.assertEqual(content, f.open().read())
def test_manifest_file(self): f = ManifestFile('chrome') f.add(ManifestContent('chrome', 'global', 'toolkit/content/global/')) f.add(ManifestResource('chrome', 'gre-resources', 'toolkit/res/')) f.add(ManifestResource('chrome/pdfjs', 'pdfjs', './')) f.add(ManifestContent('chrome/pdfjs', 'pdfjs', 'pdfjs')) f.add(ManifestLocale('chrome', 'browser', 'en-US', 'en-US/locale/browser/')) f.copy(self.tmppath('chrome.manifest')) self.assertEqual(open(self.tmppath('chrome.manifest')).readlines(), [ 'content global toolkit/content/global/\n', 'resource gre-resources toolkit/res/\n', 'resource pdfjs pdfjs/\n', 'content pdfjs pdfjs/pdfjs\n', 'locale browser en-US en-US/locale/browser/\n', ]) self.assertRaises( ValueError, f.remove, ManifestContent('', 'global', 'toolkit/content/global/') ) self.assertRaises( ValueError, f.remove, ManifestOverride('chrome', 'chrome://global/locale/netError.dtd', 'chrome://browser/locale/netError.dtd') ) f.remove(ManifestContent('chrome', 'global', 'toolkit/content/global/')) self.assertRaises( ValueError, f.remove, ManifestContent('chrome', 'global', 'toolkit/content/global/') ) f.copy(self.tmppath('chrome.manifest')) content = open(self.tmppath('chrome.manifest')).read() self.assertEqual(content[:42], f.open().read(42)) self.assertEqual(content, f.open().read())