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

Unified Diff: telemetry/telemetry/internal/backends/chrome_inspector/inspector_runtime_unittest.py

Issue 2692763002: Revert of [Telemetry] Switch clients to new JavaScript API (batch 5) (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
Index: telemetry/telemetry/internal/backends/chrome_inspector/inspector_runtime_unittest.py
diff --git a/telemetry/telemetry/internal/backends/chrome_inspector/inspector_runtime_unittest.py b/telemetry/telemetry/internal/backends/chrome_inspector/inspector_runtime_unittest.py
index 1afd723f64f1e70d0bbb4878d08df83123222911..c0fbe2d45c0c9b80fb562b61421b77ae7285158c 100644
--- a/telemetry/telemetry/internal/backends/chrome_inspector/inspector_runtime_unittest.py
+++ b/telemetry/telemetry/internal/backends/chrome_inspector/inspector_runtime_unittest.py
@@ -10,19 +10,20 @@
class InspectorRuntimeTest(tab_test_case.TabTestCase):
def testRuntimeEvaluateSimple(self):
- res = self._tab.EvaluateJavaScript2('1+1')
+ res = self._tab.EvaluateJavaScript('1+1')
assert res == 2
def testRuntimeEvaluateThatFails(self):
with self.assertRaises(exceptions.EvaluateException) as ex_context:
- self._tab.EvaluateJavaScript2('var x = 1;\nfsdfsdfsf')
+ self._tab.EvaluateJavaScript('var x = 1;\n'
+ 'fsdfsdfsf')
exception_message = str(ex_context.exception)
self.assertIn('ReferenceError: fsdfsdfsf is not defined', exception_message)
def testRuntimeEvaluateOfSomethingThatCantJSONize(self):
def test():
- self._tab.EvaluateJavaScript2("""
+ self._tab.EvaluateJavaScript("""
var cur = {};
var root = {next: cur};
for (var i = 0; i < 1000; i++) {
@@ -34,7 +35,7 @@
self.assertRaises(exceptions.EvaluateException, test)
def testRuntimeExecuteOfSomethingThatCantJSONize(self):
- self._tab.ExecuteJavaScript2('window')
+ self._tab.ExecuteJavaScript('window')
def testIFrame(self):
starting_contexts = self._tab.EnableAllContexts()
@@ -43,18 +44,18 @@
# Access host page.
test_defined_js = "typeof(testVar) != 'undefined'"
- self._tab.WaitForJavaScriptCondition2(test_defined_js, timeout=10)
+ self._tab.WaitForJavaScriptExpression(test_defined_js, timeout=10)
py_utils.WaitFor(lambda: self._tab.EnableAllContexts() != starting_contexts,
timeout=10)
- self.assertEquals(self._tab.EvaluateJavaScript2('testVar'), 'host')
+ self.assertEquals(self._tab.EvaluateJavaScript('testVar'), 'host')
def TestVarReady(context_id):
"""Returns True if the context and testVar are both ready."""
try:
- return self._tab.EvaluateJavaScript2(
- test_defined_js, context_id=context_id)
+ return self._tab.EvaluateJavaScriptInContext(test_defined_js,
+ context_id)
except exceptions.EvaluateException:
# This happens when the context is not ready.
return False
@@ -63,7 +64,7 @@
"""Waits for testVar and the context to be ready, then returns the value
of testVar."""
py_utils.WaitFor(lambda: TestVarReady(context_id), timeout=10)
- return self._tab.EvaluateJavaScript2('testVar', context_id=context_id)
+ return self._tab.EvaluateJavaScriptInContext('testVar', context_id)
all_contexts = self._tab.EnableAllContexts()
# Access parent page using EvaluateJavaScriptInContext.
@@ -78,5 +79,5 @@
# Accessing a non-existent iframe throws an exception.
self.assertRaises(exceptions.EvaluateException,
- lambda: self._tab.EvaluateJavaScript2(
- '1+1', context_id=all_contexts + 1))
+ lambda: self._tab.EvaluateJavaScriptInContext(
+ '1+1', context_id=all_contexts+1))

Powered by Google App Engine
This is Rietveld 408576698