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

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

Issue 11881051: Telemetry: add a metadata layer between page set and .wpr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no ordereddict 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
« no previous file with comments | « tools/telemetry/telemetry/page_set_unittest.py ('k') | tools/telemetry/telemetry/record_wpr.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 unittest 4 import unittest
5 5
6 from telemetry import page 6 from telemetry import page
7 7
8 class TestPage(unittest.TestCase): 8 class TestPage(unittest.TestCase):
9 def testGetUrlBaseDirAndFileForAbsolutePath(self): 9 def testGetUrlBaseDirAndFileForAbsolutePath(self):
10 apage = page.Page('file:///somedir/otherdir/file.html', 10 apage = page.Page('file:///somedir/otherdir/file.html',
11 None, # In this test, we don't need a page set.
11 base_dir='basedir') 12 base_dir='basedir')
12 dirname, filename = apage.url_base_dir_and_file 13 dirname, filename = apage.url_base_dir_and_file
13 self.assertEqual(dirname, 'basedir/somedir/otherdir') 14 self.assertEqual(dirname, 'basedir/somedir/otherdir')
14 self.assertEqual(filename, 'file.html') 15 self.assertEqual(filename, 'file.html')
15 16
16 def testGetUrlBaseDirAndFileForRelativePath(self): 17 def testGetUrlBaseDirAndFileForRelativePath(self):
17 apage = page.Page('file:///../../otherdir/file.html', 18 apage = page.Page('file:///../../otherdir/file.html',
19 None, # In this test, we don't need a page set.
18 base_dir='basedir') 20 base_dir='basedir')
19 dirname, filename = apage.url_base_dir_and_file 21 dirname, filename = apage.url_base_dir_and_file
20 self.assertEqual(dirname, 'basedir/../../otherdir') 22 self.assertEqual(dirname, 'basedir/../../otherdir')
21 self.assertEqual(filename, 'file.html') 23 self.assertEqual(filename, 'file.html')
22 24
23 def testGetUrlBaseDirAndFileForUrlBaseDir(self): 25 def testGetUrlBaseDirAndFileForUrlBaseDir(self):
24 apage = page.Page('file:///../../somedir/otherdir/file.html', 26 apage = page.Page('file:///../../somedir/otherdir/file.html',
27 None, # In this test, we don't need a page set.
25 base_dir='basedir') 28 base_dir='basedir')
26 setattr(apage, 'url_base_dir', 'file:///../../somedir/') 29 setattr(apage, 'url_base_dir', 'file:///../../somedir/')
27 dirname, filename = apage.url_base_dir_and_file 30 dirname, filename = apage.url_base_dir_and_file
28 self.assertEqual(dirname, 'basedir/../../somedir/') 31 self.assertEqual(dirname, 'basedir/../../somedir/')
29 self.assertEqual(filename, 'otherdir/file.html') 32 self.assertEqual(filename, 'otherdir/file.html')
30 33
31 def testDisplayUrlForHttp(self): 34 def testDisplayUrlForHttp(self):
32 self.assertEquals(page.Page('http://www.foo.com/').display_url, 35 self.assertEquals(page.Page('http://www.foo.com/', None).display_url,
33 'www.foo.com/') 36 'www.foo.com/')
34 37
35 def testDisplayUrlForFile(self): 38 def testDisplayUrlForFile(self):
36 self.assertEquals(page.Page('file:///../../otherdir/file.html').display_url, 39 self.assertEquals(
37 'file.html') 40 page.Page('file:///../../otherdir/file.html', None).display_url,
41 'file.html')
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/page_set_unittest.py ('k') | tools/telemetry/telemetry/record_wpr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698