OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium 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 import os | 4 import os |
5 import shutil | 5 import shutil |
6 import tempfile | 6 import tempfile |
7 import unittest | 7 import unittest |
8 | 8 |
9 from telemetry import page_set_archive_info | 9 from telemetry.page import page_set_archive_info |
10 | 10 |
11 class MockPage(object): | 11 class MockPage(object): |
12 def __init__(self, url): | 12 def __init__(self, url): |
13 self.url = url | 13 self.url = url |
14 | 14 |
15 url1 = 'http://www.foo.com/' | 15 url1 = 'http://www.foo.com/' |
16 url2 = 'http://www.bar.com/' | 16 url2 = 'http://www.bar.com/' |
17 url3 = 'http://www.baz.com/' | 17 url3 = 'http://www.baz.com/' |
18 recording1 = 'data_001.wpr' | 18 recording1 = 'data_001.wpr' |
19 recording2 = 'data_002.wpr' | 19 recording2 = 'data_002.wpr' |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 self.assertTrue(os.path.exists(os.path.join(self.tmp_dir, new_recording))) | 137 self.assertTrue(os.path.exists(os.path.join(self.tmp_dir, new_recording))) |
138 self.assertFalse(os.path.exists( | 138 self.assertFalse(os.path.exists( |
139 os.path.join(self.tmp_dir, new_temp_recording))) | 139 os.path.join(self.tmp_dir, new_temp_recording))) |
140 | 140 |
141 # Check that the archive info was written correctly. | 141 # Check that the archive info was written correctly. |
142 self.assertTrue(os.path.exists(self.page_set_archive_info_file)) | 142 self.assertTrue(os.path.exists(self.page_set_archive_info_file)) |
143 read_archive_info = page_set_archive_info.PageSetArchiveInfo.FromFile( | 143 read_archive_info = page_set_archive_info.PageSetArchiveInfo.FromFile( |
144 self.page_set_archive_info_file, '/tmp/pageset.json') | 144 self.page_set_archive_info_file, '/tmp/pageset.json') |
145 self.assertEquals(new_recording, | 145 self.assertEquals(new_recording, |
146 read_archive_info.WprFilePathForPage(page1)) | 146 read_archive_info.WprFilePathForPage(page1)) |
OLD | NEW |