| 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.core import browser_finder | 6 from telemetry.core import browser_finder |
| 7 from telemetry.unittest import navigate_test |
| 7 from telemetry.unittest import options_for_unittests | 8 from telemetry.unittest import options_for_unittests |
| 8 | 9 |
| 9 class TabTestCase(unittest.TestCase): | 10 class TabTestCase(unittest.TestCase): |
| 10 def __init__(self, *args): | 11 def __init__(self, *args): |
| 11 self._extra_browser_args = [] | 12 self._extra_browser_args = [] |
| 13 self.test_file_path = None |
| 12 super(TabTestCase, self).__init__(*args) | 14 super(TabTestCase, self).__init__(*args) |
| 13 | 15 |
| 14 def setUp(self): | 16 def setUp(self): |
| 15 self._browser = None | 17 self._browser = None |
| 16 self._tab = None | 18 self._tab = None |
| 17 options = options_for_unittests.GetCopy() | 19 options = options_for_unittests.GetCopy() |
| 18 | 20 |
| 19 self.CustomizeBrowserOptions(options) | 21 self.CustomizeBrowserOptions(options) |
| 20 | 22 |
| 21 if self._extra_browser_args: | 23 if self._extra_browser_args: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 37 | 39 |
| 38 def tearDown(self): | 40 def tearDown(self): |
| 39 if self._tab: | 41 if self._tab: |
| 40 self._tab.Disconnect() | 42 self._tab.Disconnect() |
| 41 if self._browser: | 43 if self._browser: |
| 42 self._browser.Close() | 44 self._browser.Close() |
| 43 | 45 |
| 44 def CustomizeBrowserOptions(self, options): | 46 def CustomizeBrowserOptions(self, options): |
| 45 """Override to add test-specific options to the BrowserOptions object""" | 47 """Override to add test-specific options to the BrowserOptions object""" |
| 46 pass | 48 pass |
| 49 |
| 50 def Navigate(self, filename, script_to_evaluate_on_commit=None): |
| 51 """Navigates |tab| to |filename| in the unittest data directory. |
| 52 |
| 53 Also sets up http server to point to the unittest data directory. |
| 54 """ |
| 55 self.test_file_path = navigate_test.NavigateToTestFile( |
| 56 self._tab, filename, script_to_evaluate_on_commit) |
| OLD | NEW |