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

Unified Diff: tools/chrome_remote_control/chrome_remote_control/tab_console_unittest.py

Issue 10916227: More polish in prep for CrOS support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 8 years, 3 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
Index: tools/chrome_remote_control/chrome_remote_control/tab_console_unittest.py
diff --git a/tools/chrome_remote_control/chrome_remote_control/tab_console_unittest.py b/tools/chrome_remote_control/chrome_remote_control/tab_console_unittest.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a8ceb1b83230225faa2c4c60f7c25e62eaded43
--- /dev/null
+++ b/tools/chrome_remote_control/chrome_remote_control/tab_console_unittest.py
@@ -0,0 +1,36 @@
+# 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
+import re
+import StringIO
+
+import temporary_http_server
+import tab_console
+import tab_test_case
+import util
+
+class TabConsoleTest(tab_test_case.TabTestCase):
+ def testConsoleOutputStream(self):
+ unittest_data_dir = os.path.join(os.path.dirname(__file__),
+ "..", "unittest_data")
+ with self._browser.CreateTemporaryHTTPServer(unittest_data_dir) as s:
+ stream = StringIO.StringIO()
+ res = self._tab.console.MessageOutputStream = stream
+
+ self._tab.page.Navigate(s.UrlOf("page_that_logs_to_console.html"))
+ self._tab.WaitForDocumentReadyStateToBeComplete()
+
+ initial = self._tab.runtime.Evaluate("window.__logCount")
+ def GotLog():
+ current = self._tab.runtime.Evaluate("window.__logCount")
+ return current > initial
+ util.WaitFor(GotLog, 5)
+
+ lines = [l for l in stream.getvalue().split('\n') if len(l)]
+
+ self.assertTrue(len(lines) >= 1)
+ for l in lines:
+ u_l = "http://localhost:(\d+)/page_that_logs_to_console.html:9"
+ self.assertTrue(re.match("At %s: Hello, world" % u_l, l))
+

Powered by Google App Engine
This is Rietveld 408576698