예제 #1
0
 def testUnpackedHashAppId(self):
     """ Test the output generated for a canned, unpacked extension. """
     # Copy ../../chrome/test/data/extensions/unpacked/manifest_with_key.json
     # to a temporary location.
     unpacked_test_manifest_path = os.path.join(self.CRX_ID_DIR, '..', '..',
                                                'chrome', 'test', 'data',
                                                'extensions', 'unpacked',
                                                'manifest_with_key.json')
     temp_unpacked_crx = tempfile.mkdtemp()
     shutil.copy2(unpacked_test_manifest_path,
                  os.path.join(temp_unpacked_crx, 'manifest.json'))
     self.assertEqual(crx_id.GetCRXAppID(temp_unpacked_crx),
                      self.UNPACKED_APP_ID)
     self.assertEqual(crx_id.GetCRXHash(temp_unpacked_crx),
                      self.UNPACKED_HASH_BYTES)
     self.assertTrue(crx_id.HasPublicKey(temp_unpacked_crx))
     shutil.rmtree(temp_unpacked_crx)
예제 #2
0
 def testUnpackedHashAppId(self):
     """ Test the output generated for a canned, unpacked extension. """
     temp_unpacked_crx = tempfile.mkdtemp()
     shutil.copy2(
         os.path.join(self.UNPACKED_TEST_DIR, 'manifest_with_key.json'),
         os.path.join(temp_unpacked_crx, 'manifest.json'))
     self.assertEqual(crx_id.GetCRXAppID(temp_unpacked_crx),
                      self.UNPACKED_APP_ID)
     self.assertEqual(crx_id.GetCRXHash(temp_unpacked_crx),
                      self.UNPACKED_HASH_BYTES)
     # This uses the path to compute the AppID.
     self.assertEqual(
         crx_id.GetCRXAppID('/tmp/temp_extension', from_test_path=True),
         'ajbbicncdkdlchpjplgjaglppbcbmaji')
     # Test drive letter normalization.
     kWinPathId = 'popnagglbbhjlobnnbcjnckakjoegnjp'
     self.assertEqual(
         crx_id.GetCRXAppID('c:\temp_extension', from_test_path=True),
         kWinPathId)
     self.assertEqual(
         crx_id.GetCRXAppID('C:\temp_extension', from_test_path=True),
         kWinPathId)
     shutil.rmtree(temp_unpacked_crx)
예제 #3
0
 def testPackedHashAppId(self):
     """ Test the output generated for a canned, packed CRX. """
     self.assertEqual(crx_id.GetCRXAppID(self.PACKED_CRX),
                      self.PACKED_APP_ID)
     self.assertEqual(crx_id.GetCRXHash(self.PACKED_CRX),
                      self.PACKED_HASH_BYTES)