| 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..bdcdefe60db9baa3adf7bba3bde4376799bb0afa 100644
|
| --- a/tools/telemetry/telemetry/page_set_unittest.py
|
| +++ b/tools/telemetry/telemetry/page_set_unittest.py
|
| @@ -1,16 +1,27 @@
|
| # Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
| +import os
|
| import tempfile
|
| import unittest
|
|
|
| from telemetry import page_set
|
|
|
| +simple_archive_info = """
|
| +{
|
| +"archives": {
|
| + "data_01.wpr": ["http://www.foo.com/"],
|
| + "data_02.wpr": ["http://www.bar.com/"]
|
| +}
|
| +}
|
| +"""
|
| +
|
| simple_set = """
|
| {"description": "hello",
|
| - "archive_path": "foo.wpr",
|
| + "archive_data_file": "%s",
|
| "pages": [
|
| - {"url": "http://www.foo.com/"}
|
| + {"url": "http://www.foo.com/"},
|
| + {"url": "http://www.bar.com/"}
|
| ]
|
| }
|
| """
|
| @@ -18,11 +29,19 @@ simple_set = """
|
| class TestPageSet(unittest.TestCase):
|
| def testSimpleSet(self):
|
| with tempfile.NamedTemporaryFile() as f:
|
| - f.write(simple_set)
|
| + f.write(simple_archive_info)
|
| f.flush()
|
| - ps = page_set.PageSet.FromFile(f.name)
|
| + archive_data_file = f.name
|
| +
|
| + with tempfile.NamedTemporaryFile() as f2:
|
| + f2.write(simple_set % archive_data_file)
|
| + f2.flush()
|
| + ps = page_set.PageSet.FromFile(f2.name)
|
|
|
| self.assertEquals('hello', ps.description)
|
| - self.assertEquals('foo.wpr', ps.archive_path)
|
| - self.assertEquals(1, len(ps.pages))
|
| + self.assertEquals(archive_data_file, ps.archive_data_file)
|
| + self.assertEquals(2, len(ps.pages))
|
| self.assertEquals('http://www.foo.com/', ps.pages[0].url)
|
| + self.assertEquals('http://www.bar.com/', ps.pages[1].url)
|
| + self.assertEquals('data_01.wpr', os.path.basename(ps.pages[0].archive_path))
|
| + self.assertEquals('data_02.wpr', os.path.basename(ps.pages[1].archive_path))
|
|
|