• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/python
2
3"""
4Copyright 2014 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
8
9Test download.py
10
11TODO(epoger): Create a command to update the expected results (in
12self._output_dir_expected) when appropriate.  For now, you should:
131. examine the results in self._output_dir_actual and make sure they are ok
142. rm -rf self._output_dir_expected
153. mv self._output_dir_actual self._output_dir_expected
16Although, if you're using an SVN checkout, this will blow away .svn directories
17within self._output_dir_expected, which wouldn't be good...
18
19"""
20
21# System-level imports
22import os
23import shutil
24import tempfile
25import urllib
26
27# Imports from within Skia
28import fix_pythonpath  # must do this first
29from pyutils import url_utils
30import base_unittest
31import download_actuals
32
33
34class DownloadTest(base_unittest.TestCase):
35
36  def test_fetch(self):
37    """Tests fetch() of GM results from actual-results.json ."""
38    downloader = download_actuals.Download(
39        actuals_base_url=url_utils.create_filepath_url(
40            os.path.join(self._input_dir, 'gm-actuals')),
41        gm_actuals_root_url=url_utils.create_filepath_url(
42            os.path.join(self._input_dir, 'fake-gm-imagefiles')))
43    downloader.fetch(
44        builder_name='Test-Android-GalaxyNexus-SGX540-Arm7-Release',
45        dest_dir=self._output_dir_actual)
46
47
48def main():
49  base_unittest.main(DownloadTest)
50
51
52if __name__ == '__main__':
53  main()
54