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 from telemetry import tab_test_case | 4 from telemetry import tab_test_case |
5 from telemetry import tab_crash_exception | 5 from telemetry import tab_crash_exception |
6 from telemetry import util | 6 from telemetry import util |
7 | 7 |
8 | 8 |
9 def _IsDocumentVisible(tab): | 9 def _IsDocumentVisible(tab): |
10 state = tab.runtime.Evaluate('document.webkitVisibilityState') | 10 state = tab.runtime.Evaluate('document.webkitVisibilityState') |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 def testTabBrowserIsRightBrowser(self): | 24 def testTabBrowserIsRightBrowser(self): |
25 self.assertEquals(self._tab.browser, self._browser) | 25 self.assertEquals(self._tab.browser, self._browser) |
26 | 26 |
27 def testRendererCrash(self): | 27 def testRendererCrash(self): |
28 self.assertRaises(tab_crash_exception.TabCrashException, | 28 self.assertRaises(tab_crash_exception.TabCrashException, |
29 lambda: self._tab.page.Navigate('chrome://crash', | 29 lambda: self._tab.page.Navigate('chrome://crash', |
30 timeout=5)) | 30 timeout=5)) |
31 | 31 |
32 def testActivateTab(self): | 32 def testActivateTab(self): |
| 33 if not self._browser.supports_tab_control: |
| 34 return |
33 self.assertTrue(_IsDocumentVisible(self._tab)) | 35 self.assertTrue(_IsDocumentVisible(self._tab)) |
34 new_tab = self._browser.tabs.New() | 36 new_tab = self._browser.tabs.New() |
35 util.WaitFor(lambda: _IsDocumentVisible(new_tab), timeout=5) | 37 util.WaitFor(lambda: _IsDocumentVisible(new_tab), timeout=5) |
36 self.assertFalse(_IsDocumentVisible(self._tab)) | 38 self.assertFalse(_IsDocumentVisible(self._tab)) |
37 self._tab.Activate() | 39 self._tab.Activate() |
38 util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5) | 40 util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5) |
39 self.assertFalse(_IsDocumentVisible(new_tab)) | 41 self.assertFalse(_IsDocumentVisible(new_tab)) |
40 | 42 |
OLD | NEW |