MCPcopy Create free account
hub / github.com/cztomczak/cefpython / External

Class External

unittests/main_test.py:379–413  ·  view source on GitHub ↗

Javascript 'window.external' object.

Source from the content-addressed store, hash-verified

377 self.test_case.assertEqual(frame.GetIdentifier(), 2)
378
379class External(object):
380 """Javascript 'window.external' object."""
381
382 def __init__(self, test_case):
383 self.test_case = test_case
384
385 # Test binding properties to the 'window' object.
386 # 2147483648 is out of INT_MAX limit and will be sent to JS as string value.
387 self.test_property1 = "Test binding property to the 'window' object"
388 self.test_property2 = {"key1": self.test_property1,
389 "key2": ["Inside list", 2147483647, 2147483648]}
390
391 # Asserts for True/False will be checked just before shutdown
392 self.test_for_True = True # Test whether asserts are working correctly
393 self.test_function_True = False
394 self.test_property3_function_True = False
395 self.test_callbacks_True = False
396 self.py_callback_True = False
397
398 def test_function(self):
399 """Test binding function to the 'window' object."""
400 self.test_function_True = True
401
402 def test_property3_function(self):
403 """Test binding function to the 'window' object."""
404 self.test_property3_function_True = True
405
406 def test_callbacks(self, js_callback):
407 """Test both javascript and python callbacks."""
408 def py_callback(msg_from_js):
409 self.py_callback_True = True
410 self.test_case.assertEqual(msg_from_js,
411 "String sent from Javascript")
412 self.test_callbacks_True = True
413 js_callback.Call("String sent from Python", py_callback)
414
415
416if __name__ == "__main__":

Callers 1

test_mainMethod · 0.70

Calls

no outgoing calls

Tested by 1

test_mainMethod · 0.56