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 os |
4 import unittest | 5 import unittest |
5 | 6 |
6 from telemetry.core import browser_finder | 7 from telemetry.core import browser_finder |
7 from telemetry.unittest import navigate_test | 8 from telemetry.core import util |
8 from telemetry.unittest import options_for_unittests | 9 from telemetry.unittest import options_for_unittests |
9 | 10 |
10 class TabTestCase(unittest.TestCase): | 11 class TabTestCase(unittest.TestCase): |
11 def __init__(self, *args): | 12 def __init__(self, *args): |
12 self._extra_browser_args = [] | 13 self._extra_browser_args = [] |
13 self.test_file_path = None | 14 self.test_file_path = None |
14 super(TabTestCase, self).__init__(*args) | 15 super(TabTestCase, self).__init__(*args) |
15 | 16 |
16 def setUp(self): | 17 def setUp(self): |
17 self._browser = None | 18 self._browser = None |
(...skipping 25 matching lines...) Expand all Loading... |
43 | 44 |
44 def CustomizeBrowserOptions(self, options): | 45 def CustomizeBrowserOptions(self, options): |
45 """Override to add test-specific options to the BrowserOptions object""" | 46 """Override to add test-specific options to the BrowserOptions object""" |
46 pass | 47 pass |
47 | 48 |
48 def Navigate(self, filename, script_to_evaluate_on_commit=None): | 49 def Navigate(self, filename, script_to_evaluate_on_commit=None): |
49 """Navigates |tab| to |filename| in the unittest data directory. | 50 """Navigates |tab| to |filename| in the unittest data directory. |
50 | 51 |
51 Also sets up http server to point to the unittest data directory. | 52 Also sets up http server to point to the unittest data directory. |
52 """ | 53 """ |
53 self.test_file_path = navigate_test.NavigateToTestFile( | 54 self._browser.SetHTTPServerDirectories(util.GetUnittestDataDir()) |
54 self._tab, filename, script_to_evaluate_on_commit) | 55 self.test_file_path = os.path.join(util.GetUnittestDataDir(), filename) |
| 56 self._tab.Navigate(self._browser.http_server.UrlOf(self.test_file_path), |
| 57 script_to_evaluate_on_commit) |
| 58 self._tab.WaitForDocumentReadyStateToBeComplete() |
OLD | NEW |