| Index: tools/telemetry/telemetry/page/page_unittest.py
|
| diff --git a/tools/telemetry/telemetry/page/page_unittest.py b/tools/telemetry/telemetry/page/page_unittest.py
|
| index 92be799971a927b7fc58e420471ff0a16e8441f7..61fabc07bd8ecec87a12d58ac500d385b49c5d56 100644
|
| --- a/tools/telemetry/telemetry/page/page_unittest.py
|
| +++ b/tools/telemetry/telemetry/page/page_unittest.py
|
| @@ -42,113 +42,76 @@ class TestPage(unittest.TestCase):
|
| (os.altsep and apage.file_path_url.endswith(os.altsep)))
|
|
|
| def testSort(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'http://www.foo.com/'},
|
| - {'url': 'http://www.bar.com/'}
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('http://www.foo.com/')
|
| + ps.AddPageWithDefaultRunNavigate('http://www.bar.com/')
|
| +
|
| pages = [ps.pages[0], ps.pages[1]]
|
| pages.sort()
|
| self.assertEquals([ps.pages[1], ps.pages[0]],
|
| pages)
|
|
|
| def testGetUrlBaseDirAndFileForUrlBaseDir(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'serving_dirs': ['../somedir/'],
|
| - 'pages': [
|
| - {'url': 'file://../otherdir/file.html'}
|
| - ]}, 'basedir/')
|
| + ps = page_set.PageSet(file_path='basedir/', serving_dirs=['../somedir/'])
|
| + ps.AddPageWithDefaultRunNavigate('file://../otherdir/file.html')
|
| self.assertPathEqual(ps[0].file_path, 'otherdir/file.html')
|
|
|
| def testDisplayUrlForHttp(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'http://www.foo.com/'},
|
| - {'url': 'http://www.bar.com/'}
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('http://www.foo.com/')
|
| + ps.AddPageWithDefaultRunNavigate('http://www.bar.com/')
|
| +
|
| self.assertEquals(ps[0].display_name, 'http://www.foo.com/')
|
| self.assertEquals(ps[1].display_name, 'http://www.bar.com/')
|
|
|
| def testDisplayUrlForHttps(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'http://www.foo.com/'},
|
| - {'url': 'https://www.bar.com/'}
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('http://www.foo.com/')
|
| + ps.AddPageWithDefaultRunNavigate('https://www.bar.com/')
|
| +
|
| self.assertEquals(ps[0].display_name, 'http://www.foo.com/')
|
| self.assertEquals(ps[1].display_name, 'https://www.bar.com/')
|
|
|
| def testDisplayUrlForFile(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'file://../../otherdir/foo.html'},
|
| - {'url': 'file://../../otherdir/bar.html'},
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/foo.html')
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/bar.html')
|
| +
|
| self.assertEquals(ps[0].display_name, 'foo.html')
|
| self.assertEquals(ps[1].display_name, 'bar.html')
|
|
|
| def testDisplayUrlForFilesDifferingBySuffix(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'file://../../otherdir/foo.html'},
|
| - {'url': 'file://../../otherdir/foo1.html'},
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/foo.html')
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/foo1.html')
|
| +
|
| self.assertEquals(ps[0].display_name, 'foo.html')
|
| self.assertEquals(ps[1].display_name, 'foo1.html')
|
|
|
| def testDisplayUrlForFileOfDifferentPaths(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'file://../../somedir/foo.html'},
|
| - {'url': 'file://../../otherdir/bar.html'},
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('file://../../somedir/foo.html')
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/bar.html')
|
| +
|
| self.assertEquals(ps[0].display_name, 'somedir/foo.html')
|
| self.assertEquals(ps[1].display_name, 'otherdir/bar.html')
|
|
|
| def testDisplayUrlForFileDirectories(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [
|
| - {'url': 'file://../../otherdir/foo/'},
|
| - {'url': 'file://../../otherdir/bar/'},
|
| - ]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/foo')
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/bar')
|
| +
|
| self.assertEquals(ps[0].display_name, 'foo')
|
| self.assertEquals(ps[1].display_name, 'bar')
|
|
|
| def testDisplayUrlForSingleFile(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [{'url': 'file://../../otherdir/foo.html'}]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/foo.html')
|
| +
|
| self.assertEquals(ps[0].display_name, 'foo.html')
|
|
|
| def testDisplayUrlForSingleDirectory(self):
|
| - ps = page_set.PageSet.FromDict({
|
| - 'description': 'hello',
|
| - 'archive_path': 'foo.wpr',
|
| - 'pages': [{'url': 'file://../../otherdir/foo/'}]
|
| - }, os.path.dirname(__file__))
|
| + ps = page_set.PageSet(file_path=os.path.dirname(__file__))
|
| + ps.AddPageWithDefaultRunNavigate('file://../../otherdir/foo')
|
| +
|
| self.assertEquals(ps[0].display_name, 'foo')
|
|
|