Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Unified Diff: tools/telemetry/telemetry/tab_unittest.py

Issue 11819018: [Telemetry] Clean separation between tab (public API) and tab_backend (Chrome implementation). Flat… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make unit tests pass and merge. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/telemetry/telemetry/tab_test_case.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/tab_unittest.py
diff --git a/tools/telemetry/telemetry/tab_unittest.py b/tools/telemetry/telemetry/tab_unittest.py
index f6906b27e4a8c2bedbeafc27a59fcf19a0f2b2e0..ba5e06e6642814e638dfa83a4a6fd3c0b04b1894 100644
--- a/tools/telemetry/telemetry/tab_unittest.py
+++ b/tools/telemetry/telemetry/tab_unittest.py
@@ -1,6 +1,8 @@
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
+
from telemetry import tab_test_case
from telemetry import tab_crash_exception
from telemetry import util
@@ -8,7 +10,8 @@ from telemetry import util
def _IsDocumentVisible(tab):
state = tab.runtime.Evaluate('document.webkitVisibilityState')
- tab.Disconnect()
+ # TODO(dtu): Remove when crbug.com/166243 is fixed.
+ tab._backend._Disconnect() # pylint: disable=W0212
return state == 'visible'
@@ -40,3 +43,24 @@ class TabTest(tab_test_case.TabTestCase):
util.WaitFor(lambda: _IsDocumentVisible(self._tab), timeout=5)
self.assertFalse(_IsDocumentVisible(new_tab))
+
+class GpuTabTest(tab_test_case.TabTestCase):
+ def setUp(self):
+ self._extra_browser_args = ['--enable-gpu-benchmarking']
+ super(GpuTabTest, self).setUp()
+
+ def testScreenshot(self):
+ unittest_data_dir = os.path.join(os.path.dirname(__file__),
+ '..', 'unittest_data')
+ self._browser.SetHTTPServerDirectory(unittest_data_dir)
+ self._tab.page.Navigate(
+ self._browser.http_server.UrlOf('green_rect.html'))
+ self._tab.WaitForDocumentReadyStateToBeComplete()
+
+ # Skip this test if running against a browser without screenshot support
+ if self._tab.screenshot_supported:
+ screenshot = self._tab.Screenshot(5)
+ assert screenshot
+ screenshot.GetPixelColor(0, 0).AssertIsRGB(0, 255, 0)
+ screenshot.GetPixelColor(31, 31).AssertIsRGB(0, 255, 0)
+ screenshot.GetPixelColor(32, 32).AssertIsRGB(255, 255, 255)
« no previous file with comments | « tools/telemetry/telemetry/tab_test_case.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698