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

Side by Side Diff: tools/telemetry/telemetry/core/chrome/inspector_console_unittest.py

Issue 12294002: Revert 182991 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4 import os
5 import re
6 import StringIO
7
8 from telemetry.core import util
9 from telemetry.test import tab_test_case
10
11 class TabConsoleTest(tab_test_case.TabTestCase):
12 def testConsoleOutputStream(self):
13 unittest_data_dir = os.path.join(os.path.dirname(__file__),
14 '..', '..', '..', 'unittest_data')
15 self._browser.SetHTTPServerDirectory(unittest_data_dir)
16
17 stream = StringIO.StringIO()
18 self._tab.message_output_stream = stream
19
20 self._tab.Navigate(
21 self._browser.http_server.UrlOf('page_that_logs_to_console.html'))
22 self._tab.WaitForDocumentReadyStateToBeComplete()
23
24 initial = self._tab.EvaluateJavaScript('window.__logCount')
25 def GotLog():
26 current = self._tab.EvaluateJavaScript('window.__logCount')
27 return current > initial
28 util.WaitFor(GotLog, 5)
29
30 lines = [l for l in stream.getvalue().split('\n') if len(l)]
31
32 self.assertTrue(len(lines) >= 1)
33 for l in lines:
34 u_l = 'http://localhost:(\d+)/page_that_logs_to_console.html:9'
35 self.assertTrue(re.match('At %s: Hello, world' % u_l, l))
36
OLDNEW
« no previous file with comments | « tools/telemetry/telemetry/core/chrome/inspector_console.py ('k') | tools/telemetry/telemetry/core/chrome/inspector_page.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698