1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4 from telemetry.core import exceptions
5 from telemetry.unittest import tab_test_case
7 class InspectorRuntimeTest(tab_test_case.TabTestCase):
8 def testRuntimeEvaluateSimple(self):
9 res = self._tab.EvaluateJavaScript('1+1')
12 def testRuntimeEvaluateThatFails(self):
13 self.assertRaises(exceptions.EvaluateException,
14 lambda: self._tab.EvaluateJavaScript('fsdfsdfsf'))
16 def testRuntimeEvaluateOfSomethingThatCantJSONize(self):
19 self._tab.EvaluateJavaScript("""
21 var root = {next: cur};
22 for (var i = 0; i < 1000; i++) {
28 self.assertRaises(exceptions.EvaluateException, test)
30 def testRuntimeExecuteOfSomethingThatCantJSONize(self):
31 self._tab.ExecuteJavaScript('window')