| OLD | NEW |
| 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Module containing a test suite that is run to test auto updates.""" | 5 """Module containing a test suite that is run to test auto updates.""" |
| 6 | 6 |
| 7 import os | 7 import os |
| 8 import tempfile | 8 import tempfile |
| 9 import time | 9 import time |
| 10 import unittest | 10 import unittest |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if self.data_size > (2 * 1024 * 1024): | 224 if self.data_size > (2 * 1024 * 1024): |
| 225 self.delay_count += 1 | 225 self.delay_count += 1 |
| 226 time.sleep(20) | 226 time.sleep(20) |
| 227 | 227 |
| 228 self.data_size += len(data) | 228 self.data_size += len(data) |
| 229 return data | 229 return data |
| 230 | 230 |
| 231 self.worker.Initialize(9225) | 231 self.worker.Initialize(9225) |
| 232 self.AttemptUpdateWithFilter(DelayedFilter(), proxy_port=8083) | 232 self.AttemptUpdateWithFilter(DelayedFilter(), proxy_port=8083) |
| 233 | 233 |
| 234 def SimpleTest(self): | 234 def SimpleTestUpdateAndVerify(self): |
| 235 """A simple update that updates once from a base image to a target. | 235 """Test that updates once from a base image to a target. |
| 236 | 236 |
| 237 We explicitly don't use test prefix so that isn't run by default. Can be | 237 We explicitly don't use test prefix so that isn't run by default. Can be |
| 238 run using test_prefix option. | 238 run using test_prefix option. |
| 239 """ | 239 """ |
| 240 self.worker.Initialize(9226) | 240 self.worker.Initialize(9226) |
| 241 self.worker.PrepareBase(self.base_image_path) | 241 self.worker.PrepareBase(self.base_image_path) |
| 242 self.worker.PerformUpdate(self.target_image_path, self.base_image_path) | 242 self.worker.PerformUpdate(self.target_image_path, self.base_image_path) |
| 243 self.worker.VerifyImage(self) | 243 self.worker.VerifyImage(self) |
| 244 | 244 |
| 245 def SimpleTestVerify(self): |
| 246 """Test that only verifies the target image. |
| 247 |
| 248 We explicitly don't use test prefix so that isn't run by default. Can be |
| 249 run using test_prefix option. |
| 250 """ |
| 251 self.worker.Initialize(9227) |
| 252 self.worker.PrepareBase(self.target_image_path) |
| 253 self.worker.VerifyImage(self) |
| 254 |
| 245 # --- DISABLED TESTS --- | 255 # --- DISABLED TESTS --- |
| 246 | 256 |
| 247 # TODO(sosa): Get test to work with verbose. | 257 # TODO(sosa): Get test to work with verbose. |
| 248 def NotestPartialUpdate(self): | 258 def NotestPartialUpdate(self): |
| 249 """Tests what happens if we attempt to update with a truncated payload.""" | 259 """Tests what happens if we attempt to update with a truncated payload.""" |
| 250 self.worker.Initialize(9227) | 260 self.worker.Initialize(9227) |
| 251 # Preload with the version we are trying to test. | 261 # Preload with the version we are trying to test. |
| 252 self.worker.PrepareBase(self.target_image_path) | 262 self.worker.PrepareBase(self.target_image_path) |
| 253 | 263 |
| 254 # Image can be updated at: | 264 # Image can be updated at: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 275 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \ | 285 url = 'http://gsdview.appspot.com/chromeos-localmirror/' \ |
| 276 'autest-images/corrupted_image.gz' | 286 'autest-images/corrupted_image.gz' |
| 277 payload = os.path.join(self.download_folder, 'corrupted.gz') | 287 payload = os.path.join(self.download_folder, 'corrupted.gz') |
| 278 | 288 |
| 279 # Read from the URL and write to the local file | 289 # Read from the URL and write to the local file |
| 280 urllib.urlretrieve(url, payload) | 290 urllib.urlretrieve(url, payload) |
| 281 | 291 |
| 282 # This update is expected to fail... | 292 # This update is expected to fail... |
| 283 expected_msg = 'zlib inflate() error:-3' | 293 expected_msg = 'zlib inflate() error:-3' |
| 284 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg) | 294 self.AttemptUpdateWithPayloadExpectedFailure(payload, expected_msg) |
| OLD | NEW |