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

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

Issue 16346003: Fix extension id calculation to take into account Windows encoding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated crx_id windows unit test to escape backslash Created 7 years, 6 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
« no previous file with comments | « tools/crx_id/crx_id.py ('k') | tools/telemetry/telemetry/core/extension_to_load.py » ('j') | 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 self.assertEqual(crx_id.GetCRXHash(temp_unpacked_crx), 56 self.assertEqual(crx_id.GetCRXHash(temp_unpacked_crx),
57 self.UNPACKED_HASH_BYTES) 57 self.UNPACKED_HASH_BYTES)
58 self.assertTrue(crx_id.HasPublicKey(temp_unpacked_crx)) 58 self.assertTrue(crx_id.HasPublicKey(temp_unpacked_crx))
59 shutil.rmtree(temp_unpacked_crx) 59 shutil.rmtree(temp_unpacked_crx)
60 60
61 def testFromFilePath(self): 61 def testFromFilePath(self):
62 """ Test calculation of extension id from file paths. """ 62 """ Test calculation of extension id from file paths. """
63 self.assertEqual(crx_id.GetCRXAppID('/tmp/temp_extension', 63 self.assertEqual(crx_id.GetCRXAppID('/tmp/temp_extension',
64 from_file_path=True), 64 from_file_path=True),
65 'ajbbicncdkdlchpjplgjaglppbcbmaji') 65 'ajbbicncdkdlchpjplgjaglppbcbmaji')
66
67 def testFromWindowsPath(self):
68 self.assertEqual(crx_id.GetCRXAppID(r'D:\Documents\chrome\test_extension',
69 from_file_path=True,
70 is_win_path=True),
71 'fegemedmbnhglnecjgbdhekaghkccplm')
72
66 # Test drive letter normalization. 73 # Test drive letter normalization.
67 kWinPathId = 'popnagglbbhjlobnnbcjnckakjoegnjp' 74 kWinPathId = 'aiinlcdagjihibappcdnnhcccdokjlaf'
68 self.assertEqual(crx_id.GetCRXAppID('c:\temp_extension', 75 self.assertEqual(crx_id.GetCRXAppID(r'c:\temp_extension',
69 from_file_path=True), 76 from_file_path=True,
77 is_win_path=True),
70 kWinPathId) 78 kWinPathId)
71 self.assertEqual(crx_id.GetCRXAppID('C:\temp_extension', 79 self.assertEqual(crx_id.GetCRXAppID(r'C:\temp_extension',
72 from_file_path=True), 80 from_file_path=True,
81 is_win_path=True),
73 kWinPathId) 82 kWinPathId)
74 83
75 if __name__ == '__main__': 84 if __name__ == '__main__':
76 unittest.main() 85 unittest.main()
OLDNEW
« no previous file with comments | « tools/crx_id/crx_id.py ('k') | tools/telemetry/telemetry/core/extension_to_load.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698