コード例 #1
0
 def testFromFilePath(self):
     """ Test calculation of extension id from file paths. """
     self.assertEqual(
         crx_id.GetCRXAppID('/tmp/temp_extension', from_file_path=True),
         'ajbbicncdkdlchpjplgjaglppbcbmaji')
     # Test drive letter normalization.
     kWinPathId = 'popnagglbbhjlobnnbcjnckakjoegnjp'
     self.assertEqual(
         crx_id.GetCRXAppID('c:\temp_extension', from_file_path=True),
         kWinPathId)
     self.assertEqual(
         crx_id.GetCRXAppID('C:\temp_extension', from_file_path=True),
         kWinPathId)
コード例 #2
0
  def testFromWindowsPath(self):
    self.assertEqual(crx_id.GetCRXAppID(r'D:\Documents\chrome\test_extension',
                                        from_file_path=True,
                                        is_win_path=True),
                     'fegemedmbnhglnecjgbdhekaghkccplm')

    # Test drive letter normalization.
    kWinPathId = 'aiinlcdagjihibappcdnnhcccdokjlaf'
    self.assertEqual(crx_id.GetCRXAppID(r'c:\temp_extension',
                                        from_file_path=True,
                                        is_win_path=True),
                     kWinPathId)
    self.assertEqual(crx_id.GetCRXAppID(r'C:\temp_extension',
                                        from_file_path=True,
                                        is_win_path=True),
                     kWinPathId)
コード例 #3
0
ファイル: crx_id_unittest.py プロジェクト: yubb/chromium.src
 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)
コード例 #4
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)
コード例 #5
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)
コード例 #6
0
 def testFromFilePath(self):
   """ Test calculation of extension id from file paths. """
   self.assertEqual(crx_id.GetCRXAppID('/tmp/temp_extension',
                                       from_file_path=True),
                    'ajbbicncdkdlchpjplgjaglppbcbmaji')