OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 |
| 5 goog.require('goog.DevTools.DOM'); |
| 6 goog.require('goog.DevTools.Runtime'); |
| 7 goog.require('goog.DevTools.TestHarness'); |
| 8 goog.provide('goog.DevTools.BindingsTest'); |
| 9 |
| 10 goog.DevTools.TestHarness.AddTest("Simple Test", function(test) { |
| 11 var Runtime = new goog.DevTools.Runtime(test.connection_); |
| 12 Runtime.Evaluate({'expression': '1+1'}).then(function(message) { |
| 13 test.AssertEq(2, message.result.value, "(message.result.value)"); |
| 14 test.Finish(); |
| 15 }); |
| 16 }); |
| 17 |
| 18 goog.DevTools.TestHarness.AddTest("Event Test", function(test) { |
| 19 var DOM = new goog.DevTools.DOM(test.connection_); |
| 20 var Runtime = new goog.DevTools.Runtime(test.connection_); |
| 21 var bodyNode = {}; |
| 22 DOM.Enable().then(function() { |
| 23 DOM.OnChildNodeCountUpdated(function(params) { |
| 24 test.AssertEq(1, params.childNodeCount, "(params.childNodeCount)"); |
| 25 test.AssertEq(bodyNode.nodeId, params.nodeId, "(params.nodeId)"); |
| 26 test.Finish(); |
| 27 }); |
| 28 DOM.GetDocument({}).then(function(result) { |
| 29 bodyNode = result.root.children[0].children[1]; |
| 30 test.AssertEq("BODY", bodyNode.nodeName, "(bodyNode.nodeName)"); |
| 31 var div = document.createElement('div'); |
| 32 document.body.appendChild(div); |
| 33 }); |
| 34 }); |
| 35 }); |
| 36 |
| 37 goog.DevTools.TestHarness.RunTests(); |
OLD | NEW |