| OLD | NEW |
| 1 # Copyright 2012 The Chromium Authors. All rights reserved. | 1 # Copyright 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 | 4 |
| 5 import logging | 5 import logging |
| 6 import tempfile | 6 import tempfile |
| 7 | 7 |
| 8 from telemetry.core import exceptions | 8 from telemetry.core import exceptions |
| 9 from telemetry.core import util | 9 from telemetry.core import util |
| 10 from telemetry import decorators | 10 from telemetry import decorators |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 def testNavigateAndWaitForInteractiveState(self): | 57 def testNavigateAndWaitForInteractiveState(self): |
| 58 self._tab.Navigate(self.UrlOfUnittestFile('blank.html')) | 58 self._tab.Navigate(self.UrlOfUnittestFile('blank.html')) |
| 59 self._tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() | 59 self._tab.WaitForDocumentReadyStateToBeInteractiveOrBetter() |
| 60 | 60 |
| 61 def testTabBrowserIsRightBrowser(self): | 61 def testTabBrowserIsRightBrowser(self): |
| 62 self.assertEquals(self._tab.browser, self._browser) | 62 self.assertEquals(self._tab.browser, self._browser) |
| 63 | 63 |
| 64 def testRendererCrash(self): | 64 def testRendererCrash(self): |
| 65 self.assertRaises(exceptions.DevtoolsTargetCrashException, | 65 self.assertRaises(exceptions.DevtoolsTargetCrashException, |
| 66 lambda: self._tab.Navigate('chrome://crash', | 66 lambda: self._tab.Navigate('chrome://crash', |
| 67 timeout=30)) | 67 timeout=5)) |
| 68 | 68 |
| 69 @decorators.Enabled('has tabs') | 69 @decorators.Enabled('has tabs') |
| 70 def testActivateTab(self): | 70 def testActivateTab(self): |
| 71 util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5) | 71 util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5) |
| 72 new_tab = self._browser.tabs.New() | 72 new_tab = self._browser.tabs.New() |
| 73 new_tab.Navigate('about:blank') | 73 new_tab.Navigate('about:blank') |
| 74 util.WaitFor(lambda: _IsDocumentVisible(new_tab), timeout=5) | 74 util.WaitFor(lambda: _IsDocumentVisible(new_tab), timeout=5) |
| 75 self.assertFalse(_IsDocumentVisible(self._tab)) | 75 self.assertFalse(_IsDocumentVisible(self._tab)) |
| 76 self._tab.Activate() | 76 self._tab.Activate() |
| 77 util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5) | 77 util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 assert screenshot is not None | 196 assert screenshot is not None |
| 197 image_util.GetPixelColor( | 197 image_util.GetPixelColor( |
| 198 screenshot, 0 * pixel_ratio, 0 * pixel_ratio).AssertIsRGB( | 198 screenshot, 0 * pixel_ratio, 0 * pixel_ratio).AssertIsRGB( |
| 199 0, 255, 0, tolerance=2) | 199 0, 255, 0, tolerance=2) |
| 200 image_util.GetPixelColor( | 200 image_util.GetPixelColor( |
| 201 screenshot, 31 * pixel_ratio, 31 * pixel_ratio).AssertIsRGB( | 201 screenshot, 31 * pixel_ratio, 31 * pixel_ratio).AssertIsRGB( |
| 202 0, 255, 0, tolerance=2) | 202 0, 255, 0, tolerance=2) |
| 203 image_util.GetPixelColor( | 203 image_util.GetPixelColor( |
| 204 screenshot, 32 * pixel_ratio, 32 * pixel_ratio).AssertIsRGB( | 204 screenshot, 32 * pixel_ratio, 32 * pixel_ratio).AssertIsRGB( |
| 205 255, 255, 255, tolerance=2) | 205 255, 255, 255, tolerance=2) |
| OLD | NEW |