Chromium Code Reviews| Index: tools/telemetry/telemetry/page_set_unittest.py |
| diff --git a/tools/telemetry/telemetry/page_set_unittest.py b/tools/telemetry/telemetry/page_set_unittest.py |
| index ef1a83c7302c12093c8f553e8df8c683459c4053..f6c741fd4ccf90fb3e61fb1929838cec2d71c639 100644 |
| --- a/tools/telemetry/telemetry/page_set_unittest.py |
| +++ b/tools/telemetry/telemetry/page_set_unittest.py |
| @@ -6,9 +6,15 @@ import unittest |
| from telemetry import page_set |
| +simple_metadata = """ |
| +{ |
| +"archives": [] |
|
dtu
2013/01/23 21:07:02
Can you have a test with something in the archives
marja
2013/01/24 16:03:33
I added a test here for testing that the archive p
|
| +} |
| +""" |
| + |
| simple_set = """ |
| {"description": "hello", |
| - "archive_path": "foo.wpr", |
| + "archive_data_file": "%s", |
| "pages": [ |
| {"url": "http://www.foo.com/"} |
| ] |
| @@ -18,11 +24,16 @@ simple_set = """ |
| class TestPageSet(unittest.TestCase): |
| def testSimpleSet(self): |
| with tempfile.NamedTemporaryFile() as f: |
| - f.write(simple_set) |
| + f.write(simple_metadata) |
| f.flush() |
| - ps = page_set.PageSet.FromFile(f.name) |
| + archive_data_file = f.name |
| + |
| + with tempfile.NamedTemporaryFile() as f: |
| + f.write(simple_set % archive_data_file) |
| + f.flush() |
| + ps = page_set.PageSet.FromFile(f.name) |
| self.assertEquals('hello', ps.description) |
| - self.assertEquals('foo.wpr', ps.archive_path) |
| + self.assertEquals(archive_data_file, ps.archive_data_file) |
| self.assertEquals(1, len(ps.pages)) |
| self.assertEquals('http://www.foo.com/', ps.pages[0].url) |