Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: tools/telemetry/telemetry/page_set_unittest.py

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4 import os
5 import tempfile
6 import unittest
7
8 from telemetry import page_set
9
10 simple_archive_info = """
11 {
12 "archives": {
13 "data_01.wpr": ["http://www.foo.com/"],
14 "data_02.wpr": ["http://www.bar.com/"]
15 }
16 }
17 """
18
19 simple_set = """
20 {"description": "hello",
21 "archive_data_file": "%s",
22 "pages": [
23 {"url": "http://www.foo.com/"},
24 {"url": "http://www.bar.com/"}
25 ]
26 }
27 """
28
29 class TestPageSet(unittest.TestCase):
30 def testSimpleSet(self):
31 with tempfile.NamedTemporaryFile() as f:
32 f.write(simple_archive_info)
33 f.flush()
34 archive_data_file = f.name
35
36 with tempfile.NamedTemporaryFile() as f2:
37 f2.write(simple_set % archive_data_file)
38 f2.flush()
39 ps = page_set.PageSet.FromFile(f2.name)
40
41 self.assertEquals('hello', ps.description)
42 self.assertEquals(archive_data_file, ps.archive_data_file)
43 self.assertEquals(2, len(ps.pages))
44 self.assertEquals('http://www.foo.com/', ps.pages[0].url)
45 self.assertEquals('http://www.bar.com/', ps.pages[1].url)
46 self.assertEquals('data_01.wpr', os.path.basename(ps.pages[0].archive_path))
47 self.assertEquals('data_02.wpr', os.path.basename(ps.pages[1].archive_path))
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page_set_archive_info_unittest.py ('k') | tools/telemetry/telemetry/page_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698