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

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

Issue 2743013002: Add webdriver endpoint to send custom debugger commands (Closed)
Patch Set: Adding stub, quick code reorg Created 3 years, 7 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
« no previous file with comments | « chrome/test/chromedriver/server/http_handler.cc ('k') | chrome/test/chromedriver/window_commands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..618af26d8a769d3d41e7fec4b0432565c51380e7 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,18 @@ 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')
+ 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."""
« no previous file with comments | « chrome/test/chromedriver/server/http_handler.cc ('k') | chrome/test/chromedriver/window_commands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698