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

Side by Side Diff: native_client_sdk/src/build_tools/tests/update_manifest_test.py

Issue 8801030: Fixed update_manifest to correctly accept format: pepper -b .. -B ..... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « native_client_sdk/src/build_tools/tests/pepper_1_0/naclsdk_win.exe ('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 # Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Unit tests for update_manifest.py.""" 6 """Unit tests for update_manifest.py."""
7 7
8 __author__ = 'mball@google.com (Matt Ball)' 8 __author__ = 'mball@google.com (Matt Ball)'
9 9
10 import errno 10 import errno
11 import os 11 import os
12 import SimpleHTTPServer 12 import SimpleHTTPServer
13 import SocketServer 13 import SocketServer
14 import sys 14 import sys
15 import tempfile 15 import tempfile
16 import threading 16 import threading
17 import unittest 17 import unittest
18 import urllib
18 import urlparse 19 import urlparse
19 20
20 from build_tools.sdk_tools import sdk_update 21 from build_tools.sdk_tools import sdk_update
21 from build_tools.sdk_tools import update_manifest 22 from build_tools.sdk_tools import update_manifest
22 23
23 TEST_DIR = os.path.dirname(os.path.abspath(__file__)) 24 TEST_DIR = os.path.dirname(os.path.abspath(__file__))
24 25
25 26
26 def RemoveFile(filename): 27 def RemoveFile(filename):
27 '''Remove a filename if it exists and do nothing if it doesn't exist''' 28 '''Remove a filename if it exists and do nothing if it doesn't exist'''
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 self.bundle_version = None 67 self.bundle_version = None
67 self.bundle_revision = None 68 self.bundle_revision = None
68 self.desc = None 69 self.desc = None
69 self.gsutil = os.path.join(TEST_DIR, 'fake_gsutil.bat' 70 self.gsutil = os.path.join(TEST_DIR, 'fake_gsutil.bat'
70 if sys.platform == 'win32' else 'fake_gsutil.py') 71 if sys.platform == 'win32' else 'fake_gsutil.py')
71 self.linux_arch_url = None 72 self.linux_arch_url = None
72 self.mac_arch_url = None 73 self.mac_arch_url = None
73 self.manifest_file = os.path.join(TEST_DIR, 'naclsdk_manifest_test.json') 74 self.manifest_file = os.path.join(TEST_DIR, 'naclsdk_manifest_test.json')
74 self.manifest_version = None 75 self.manifest_version = None
75 self.recommended = None 76 self.recommended = None
76 self.root_url = 'http://localhost/test_url' 77 self.root_url = 'file://%s' % urllib.pathname2url(TEST_DIR)
77 self.stability = None 78 self.stability = None
78 self.upload = False 79 self.upload = False
79 self.win_arch_url = None 80 self.win_arch_url = None
80 81
81 82
82 class TestUpdateManifest(unittest.TestCase): 83 class TestUpdateManifest(unittest.TestCase):
83 ''' Test basic functionality of the update_manifest package. 84 ''' Test basic functionality of the update_manifest package.
84 85
85 Note that update_manifest.py now imports sdk_update.py, so this file 86 Note that update_manifest.py now imports sdk_update.py, so this file
86 tests the update_manifest features within sdk_update.''' 87 tests the update_manifest features within sdk_update.'''
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 update_manifest.UpdateSDKManifestFile(options).HandleBundles() 312 update_manifest.UpdateSDKManifestFile(options).HandleBundles()
312 313
313 def testHandlePepper(self): 314 def testHandlePepper(self):
314 '''Test the handling of pepper bundles''' 315 '''Test the handling of pepper bundles'''
315 options = FakeOptions() 316 options = FakeOptions()
316 options.bundle_name = 'pepper' 317 options.bundle_name = 'pepper'
317 options.bundle_version = None 318 options.bundle_version = None
318 self.assertRaises( 319 self.assertRaises(
319 update_manifest.Error, 320 update_manifest.Error,
320 update_manifest.UpdateSDKManifestFile(options).HandleBundles) 321 update_manifest.UpdateSDKManifestFile(options).HandleBundles)
322 options.bundle_name = 'pepper'
321 options.bundle_version = 1 323 options.bundle_version = 1
322 options.bundle_revision = None 324 options.bundle_revision = None
323 self.assertRaises( 325 self.assertRaises(
324 update_manifest.Error, 326 update_manifest.Error,
325 update_manifest.UpdateSDKManifestFile(options).HandleBundles) 327 update_manifest.UpdateSDKManifestFile(options).HandleBundles)
328 options.bundle_name = 'pepper'
326 options.bundle_revision = 0 329 options.bundle_revision = 0
327 update_manifest.UpdateSDKManifestFile(options).HandleBundles() 330 manifest_object = update_manifest.UpdateSDKManifestFile(options)
331 manifest_object.HandleBundles()
332 manifest_object.UpdateWithOptions()
333
334 options = FakeOptions()
328 options.bundle_name = 'pepper_1' 335 options.bundle_name = 'pepper_1'
329 options.bundle_version = None 336 options.bundle_revision = 0
330 update_manifest.UpdateSDKManifestFile(options).HandleBundles() 337 manifest_object = update_manifest.UpdateSDKManifestFile(options)
338 manifest_object.HandleBundles()
339 manifest_object.UpdateWithOptions()
331 340
332 341
333 def main(): 342 def main():
334 suite = unittest.TestLoader().loadTestsFromTestCase(TestUpdateManifest) 343 suite = unittest.TestLoader().loadTestsFromTestCase(TestUpdateManifest)
335 result = unittest.TextTestRunner(verbosity=2).run(suite) 344 result = unittest.TextTestRunner(verbosity=2).run(suite)
336 345
337 return int(not result.wasSuccessful()) 346 return int(not result.wasSuccessful())
338 347
339 348
340 if __name__ == '__main__': 349 if __name__ == '__main__':
341 sys.exit(main()) 350 sys.exit(main())
OLDNEW
« no previous file with comments | « native_client_sdk/src/build_tools/tests/pepper_1_0/naclsdk_win.exe ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698