Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(800)

Side by Side Diff: tools/crx_id/crx_id_unittest.py

Issue 12385037: Add HasPublicKey to crx_id. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: rename from_test_path to from_file_path Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/crx_id/crx_id.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Verify that crx_id.py generates a reasonable string for a canned CRX file. 7 """Verify that crx_id.py generates a reasonable string for a canned CRX file.
8 """ 8 """
9 9
10 import crx_id 10 import crx_id
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 '{0x21, 0x23, 0x83, 0x27, 0x1f, 0xf0, 0xd6, 0x29,' \ 46 '{0x21, 0x23, 0x83, 0x27, 0x1f, 0xf0, 0xd6, 0x29,' \
47 ' 0xe3, 0x3b, 0xf3, 0x9b, 0x4d, 0xd6, 0x9b, 0x3a,' \ 47 ' 0xe3, 0x3b, 0xf3, 0x9b, 0x4d, 0xd6, 0x9b, 0x3a,' \
48 ' 0xff, 0x7d, 0x6b, 0xc4, 0x78, 0x30, 0x47, 0xa6,' \ 48 ' 0xff, 0x7d, 0x6b, 0xc4, 0x78, 0x30, 0x47, 0xa6,' \
49 ' 0x23, 0x12, 0x72, 0x84, 0x9b, 0x9a, 0xf6, 0x3c}' 49 ' 0x23, 0x12, 0x72, 0x84, 0x9b, 0x9a, 0xf6, 0x3c}'
50 50
51 def testUnpackedHashAppId(self): 51 def testUnpackedHashAppId(self):
52 """ Test the output generated for a canned, unpacked extension. """ 52 """ Test the output generated for a canned, unpacked extension. """
53 temp_unpacked_crx = tempfile.mkdtemp() 53 temp_unpacked_crx = tempfile.mkdtemp()
54 shutil.copy2(os.path.join(self.UNPACKED_TEST_DIR, 54 shutil.copy2(os.path.join(self.UNPACKED_TEST_DIR,
55 'manifest_with_key.json'), 55 'manifest_with_key.json'),
56 os.path.join(temp_unpacked_crx, 56 os.path.join(temp_unpacked_crx,
jvoung (off chromium) 2013/03/01 03:17:22 Perhaps you can test your new method against the t
achuithb 2013/03/01 09:05:01 Done.
57 'manifest.json')) 57 'manifest.json'))
58 self.assertEqual(crx_id.GetCRXAppID(temp_unpacked_crx), 58 self.assertEqual(crx_id.GetCRXAppID(temp_unpacked_crx),
59 self.UNPACKED_APP_ID) 59 self.UNPACKED_APP_ID)
60 self.assertEqual(crx_id.GetCRXHash(temp_unpacked_crx), 60 self.assertEqual(crx_id.GetCRXHash(temp_unpacked_crx),
61 self.UNPACKED_HASH_BYTES) 61 self.UNPACKED_HASH_BYTES)
62 # This uses the path to compute the AppID. 62 # This uses the path to compute the AppID.
63 self.assertEqual(crx_id.GetCRXAppID('/tmp/temp_extension', 63 self.assertEqual(crx_id.GetCRXAppID('/tmp/temp_extension',
64 from_test_path=True), 64 from_file_path=True),
65 'ajbbicncdkdlchpjplgjaglppbcbmaji') 65 'ajbbicncdkdlchpjplgjaglppbcbmaji')
66 # Test drive letter normalization. 66 # Test drive letter normalization.
67 kWinPathId = 'popnagglbbhjlobnnbcjnckakjoegnjp' 67 kWinPathId = 'popnagglbbhjlobnnbcjnckakjoegnjp'
68 self.assertEqual(crx_id.GetCRXAppID('c:\temp_extension', 68 self.assertEqual(crx_id.GetCRXAppID('c:\temp_extension',
69 from_test_path=True), 69 from_file_path=True),
70 kWinPathId) 70 kWinPathId)
71 self.assertEqual(crx_id.GetCRXAppID('C:\temp_extension', 71 self.assertEqual(crx_id.GetCRXAppID('C:\temp_extension',
72 from_test_path=True), 72 from_file_path=True),
73 kWinPathId) 73 kWinPathId)
74 shutil.rmtree(temp_unpacked_crx) 74 shutil.rmtree(temp_unpacked_crx)
75 75
76 76
77 if __name__ == '__main__': 77 if __name__ == '__main__':
78 unittest.main() 78 unittest.main()
OLDNEW
« no previous file with comments | « tools/crx_id/crx_id.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698