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

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

Issue 12278015: [Telemetry] Reorganize everything. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add shebangs. 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
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 os
5 import re 5 import re
6 import StringIO 6 import StringIO
7 7
8 from telemetry import tab_test_case 8 from telemetry.core import util
9 from telemetry import util 9 from telemetry.test import tab_test_case
10 10
11 class TabConsoleTest(tab_test_case.TabTestCase): 11 class TabConsoleTest(tab_test_case.TabTestCase):
12 def testConsoleOutputStream(self): 12 def testConsoleOutputStream(self):
13 unittest_data_dir = os.path.join(os.path.dirname(__file__), 13 unittest_data_dir = os.path.join(os.path.dirname(__file__),
14 '..', 'unittest_data') 14 '..', '..', '..', 'unittest_data')
15 self._browser.SetHTTPServerDirectory(unittest_data_dir) 15 self._browser.SetHTTPServerDirectory(unittest_data_dir)
16 16
17 stream = StringIO.StringIO() 17 stream = StringIO.StringIO()
18 self._tab.message_output_stream = stream 18 self._tab.message_output_stream = stream
19 19
20 self._tab.Navigate( 20 self._tab.Navigate(
21 self._browser.http_server.UrlOf('page_that_logs_to_console.html')) 21 self._browser.http_server.UrlOf('page_that_logs_to_console.html'))
22 self._tab.WaitForDocumentReadyStateToBeComplete() 22 self._tab.WaitForDocumentReadyStateToBeComplete()
23 23
24 initial = self._tab.EvaluateJavaScript('window.__logCount') 24 initial = self._tab.EvaluateJavaScript('window.__logCount')
25 def GotLog(): 25 def GotLog():
26 current = self._tab.EvaluateJavaScript('window.__logCount') 26 current = self._tab.EvaluateJavaScript('window.__logCount')
27 return current > initial 27 return current > initial
28 util.WaitFor(GotLog, 5) 28 util.WaitFor(GotLog, 5)
29 29
30 lines = [l for l in stream.getvalue().split('\n') if len(l)] 30 lines = [l for l in stream.getvalue().split('\n') if len(l)]
31 31
32 self.assertTrue(len(lines) >= 1) 32 self.assertTrue(len(lines) >= 1)
33 for l in lines: 33 for l in lines:
34 u_l = 'http://localhost:(\d+)/page_that_logs_to_console.html:9' 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)) 35 self.assertTrue(re.match('At %s: Hello, world' % u_l, l))
36 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