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

Unified Diff: native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py

Issue 11200002: update_nacl_manifest improvements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py
diff --git a/native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py b/native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py
index 5d2525b37eaeebc6d55ea0d28616b50a2f311463..1749331ede36fd106186154a0f234461273a658c 100755
--- a/native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py
+++ b/native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py
@@ -5,10 +5,12 @@
import copy
import datetime
+import hashlib
import os
import posixpath
import subprocess
import sys
+import tempfile
import unittest
import urlparse
@@ -158,6 +160,7 @@ class TestDelegate(update_nacl_manifest.Delegate):
self.history = history
self.files = files
self.version_mapping = version_mapping
+ self.dryrun = 0
def GetRepoManifest(self):
return self.manifest
@@ -513,11 +516,35 @@ mac,canary,21.0.1156.0,2012-05-30 12:14:21.305090"""
self.assertEqual(len(self.uploaded_manifest.GetBundles()), 1)
-def main():
- suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__])
- result = unittest.TextTestRunner(verbosity=2).run(suite)
+class TestUpdateVitals(unittest.TestCase):
+ def setUp(self):
+ f = tempfile.NamedTemporaryFile('w', prefix="test_update_nacl_manifest")
+ self.test_file = f.name
+ f.close()
+ test_data = "Some test data\n"
+ self.sha1 = hashlib.sha1(test_data).hexdigest()
+ with open(self.test_file, 'w') as f:
+ f.write(test_data)
+
+ def tearDown(self):
+ os.remove(self.test_file)
+
+ def testUpdateVitals(self):
+ archive = manifest_util.Archive(manifest_util.GetHostOS())
+ archive.url = 'file://%s' % os.path.abspath(self.test_file)
+ bundle = MakeBundle(18)
+ bundle.AddArchive(archive)
+ manifest = MakeManifest(bundle)
+ archive = manifest.GetBundles()[0]['archives'][0]
+
+ self.assertTrue('size' not in archive)
+ self.assertTrue('checksum' not in archive)
+
+ manifest.Validate()
+
+ self.assertEqual(archive['size'], 15)
+ self.assertEqual(archive['checksum']['sha1'], self.sha1)
- return int(not result.wasSuccessful())
if __name__ == '__main__':
- sys.exit(main())
+ unittest.main()
« no previous file with comments | « native_client_sdk/src/build_tools/nacl-mono-buildbot.py ('k') | native_client_sdk/src/build_tools/update_nacl_manifest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698