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

Unified Diff: chrome/test/chromedriver/test/run_py_tests.py

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: Adding e2e test Created 3 years, 8 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: chrome/test/chromedriver/test/run_py_tests.py
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py
index ffdfa085d1a6a8eab2c38b99458b7c57becc4bd8..15035347bc2b33ff00466abbcd7d3166714c0130 100755
--- a/chrome/test/chromedriver/test/run_py_tests.py
+++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -179,7 +179,7 @@ _ANDROID_NEGATIVE_FILTER['chromium'] = (
)
_ANDROID_NEGATIVE_FILTER['chromedriver_webview_shell'] = (
_ANDROID_NEGATIVE_FILTER['chrome'] + [
- 'PerformanceLoggerTest.testPerformanceLogger',
+ 'ChromeLoggingCapabilityTest.testPerformanceLogger',
'ChromeDriverTest.testShadowDom*',
# WebView doesn't support emulating network conditions.
'ChromeDriverTest.testEmulateNetworkConditions',
@@ -1041,6 +1041,25 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
# navigation tracker to block the call to Load() above.
self.WaitForCondition(lambda: 'is not available' in self._driver.GetTitle())
+ def testSendCommand(self):
+ #Sends a custom command to the DevTools debugger
+ params = {}
+ res = self._driver.SendCommandAndGetResult('CSS.enable', params)
+ self.assertEqual({}, res)
+
+ def testSendCommandNoParams(self):
+ #Sends a custom command to the DevTools debugger
+ self.assertRaisesRegexp(
+ chromedriver.UnknownError, "params not passed",
+ self._driver.SendCommandAndGetResult, 'CSS.enable', None)
+
+ def testSendCommandAndGetResult(self):
+ #Sends a custom command to the DevTools debugger and gets the result
+ self._driver.Load(self.GetHttpUrlForFile('/chromedriver/page_test.html'))
+ params = {}
+ document = self._driver.SendCommandAndGetResult('DOM.getDocument', params)
+ self.assertTrue('root' in document)
+
def testShadowDomFindElementWithSlashDeep(self):
"""Checks that chromedriver can find elements in a shadow DOM using /deep/
css selectors."""
@@ -2181,7 +2200,7 @@ class ChromeDriverLogTest(ChromeDriverBaseTest):
self.assertNotIn('bosco', f.read())
-class PerformanceLoggerTest(ChromeDriverBaseTest):
+class ChromeLoggingCapabilityTest(ChromeDriverBaseTest):
"""Tests chromedriver tracing support and Inspector event collection."""
def testPerformanceLogger(self):
@@ -2218,6 +2237,18 @@ class PerformanceLoggerTest(ChromeDriverBaseTest):
self.assertEquals({'Network', 'Page', 'Tracing'},
set(seen_log_domains.keys()))
+ def testDevToolsEventsLogger(self):
+ event = 'Page.loadEventFired'
+ driver = self.CreateDriver(
+ devtools_events_to_log=[event], logging_prefs={'devtools':'ALL'})
+ driver.Load('about:blank')
+ logs = driver.GetLog('devtools')
+ print logs
+ for entry in logs:
+ devtools_message = json.loads(entry['message'])
+ method = devtools_message['method']
+ self.assertTrue('params' in devtools_message)
+ self.assertEquals(event, method)
class SessionHandlingTest(ChromeDriverBaseTest):
"""Tests for session operations."""

Powered by Google App Engine
This is Rietveld 408576698