diff options
author | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 21:39:52 +0000 |
---|---|---|
committer | binji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-18 21:39:52 +0000 |
commit | f29928700facfbad06796c4031417c094f4f5157 (patch) | |
tree | 7f6dd9e1aef81ce07cb8740c33afec34d5527e4b /native_client_sdk | |
parent | 09b0ec2edd2fae3fc75811bc9363045686e75341 (diff) | |
download | chromium_src-f29928700facfbad06796c4031417c094f4f5157.zip chromium_src-f29928700facfbad06796c4031417c094f4f5157.tar.gz chromium_src-f29928700facfbad06796c4031417c094f4f5157.tar.bz2 |
[NaCl SDK] Fix TestUpdateVitals on Windows.
It seems that urllib2 on Windows expects file scheme URLs to have the format
file:///C:\foo\bar\...
BUG=none
TBR=binji@chromium.org
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11186060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162801 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-x | native_client_sdk/src/build_tools/tests/test_update_nacl_manifest.py | 14 |
1 files changed, 11 insertions, 3 deletions
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 50baef1..11b565d 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 @@ -521,8 +521,9 @@ class TestUpdateVitals(unittest.TestCase): f = tempfile.NamedTemporaryFile('w', prefix="test_update_nacl_manifest") self.test_file = f.name f.close() - test_data = "Some test data\n" + test_data = "Some test data" self.sha1 = hashlib.sha1(test_data).hexdigest() + self.data_len = len(test_data) with open(self.test_file, 'w') as f: f.write(test_data) @@ -531,7 +532,14 @@ class TestUpdateVitals(unittest.TestCase): def testUpdateVitals(self): archive = manifest_util.Archive(manifest_util.GetHostOS()) - archive.url = 'file://%s' % os.path.abspath(self.test_file) + path = os.path.abspath(self.test_file) + if sys.platform == 'win32': + # On Windows, the path must start with three slashes, i.e. + # (file:///C:\whatever) + path = '/' + path + archive.url = 'file://' + path + print archive.url + bundle = MakeBundle(18) bundle.AddArchive(archive) manifest = MakeManifest(bundle) @@ -543,7 +551,7 @@ class TestUpdateVitals(unittest.TestCase): manifest.Validate(add_missing_info=True) - self.assertEqual(archive['size'], 15) + self.assertEqual(archive['size'], self.data_len) self.assertEqual(archive['checksum']['sha1'], self.sha1) |