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

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

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: Fixing indentation 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 dce78013ac4df70909d9d2e14b4cf72e7594389f..923ed838d49f02ff79b4e3223953023c10d4694d 100755
--- a/chrome/test/chromedriver/test/run_py_tests.py
+++ b/chrome/test/chromedriver/test/run_py_tests.py
@@ -175,7 +175,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',
@@ -1062,6 +1062,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 without params"""
+ 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."""
@@ -2217,7 +2236,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):
@@ -2252,6 +2271,19 @@ class PerformanceLoggerTest(ChromeDriverBaseTest):
self.assertEquals({'Network', 'Page', 'Tracing'},
set(seen_log_domains.keys()))
+ def testDevToolsEventsLogger(self):
+ """Tests that the correct event type (and no other) is logged"""
+ 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
stgao 2017/05/03 20:24:44 need removing
em 2017/05/04 01:11:22 Done.
+ 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