| OLD | NEW |
| 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.page 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 None, # In this test, we don't need a page set. |
| 12 base_dir='basedir') | 12 base_dir='basedir') |
| 13 dirname, filename = apage.url_base_dir_and_file | 13 dirname, filename = apage.url_base_dir_and_file |
| 14 self.assertEqual(dirname, 'basedir/somedir/otherdir') | 14 self.assertEqual(dirname, 'basedir/somedir/otherdir') |
| 15 self.assertEqual(filename, 'file.html') | 15 self.assertEqual(filename, 'file.html') |
| 16 | 16 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 32 self.assertEqual(filename, 'otherdir/file.html') | 32 self.assertEqual(filename, 'otherdir/file.html') |
| 33 | 33 |
| 34 def testDisplayUrlForHttp(self): | 34 def testDisplayUrlForHttp(self): |
| 35 self.assertEquals(page.Page('http://www.foo.com/', None).display_url, | 35 self.assertEquals(page.Page('http://www.foo.com/', None).display_url, |
| 36 'www.foo.com/') | 36 'www.foo.com/') |
| 37 | 37 |
| 38 def testDisplayUrlForFile(self): | 38 def testDisplayUrlForFile(self): |
| 39 self.assertEquals( | 39 self.assertEquals( |
| 40 page.Page('file:///../../otherdir/file.html', None).display_url, | 40 page.Page('file:///../../otherdir/file.html', None).display_url, |
| 41 'file.html') | 41 'file.html') |
| OLD | NEW |