Chromium Code Reviews| Index: headless/test/bindings_test.js |
| diff --git a/headless/test/bindings_test.js b/headless/test/bindings_test.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ad891e4cfdfee9143d0d710e567f68c6770427a5 |
| --- /dev/null |
| +++ b/headless/test/bindings_test.js |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +goog.require('goog.DevTools.DOM'); |
| +goog.require('goog.DevTools.Runtime'); |
| +goog.require('goog.DevTools.TestHarness'); |
| +goog.provide('goog.DevTools.BindingsTest'); |
| + |
| +goog.DevTools.TestHarness.AddTest("Simple Test", function(test) { |
| + var Runtime = new goog.DevTools.Runtime(test.connection_); |
| + Runtime.Evaluate({'expression': '1+1'}).then(function(message) { |
| + test.AssertEq(2, message.result.value, "(message.result.value)"); |
| + test.Finish(); |
| + }); |
| +}); |
| + |
| +goog.DevTools.TestHarness.AddTest("Event Test", function(test) { |
| + var DOM = new goog.DevTools.DOM(test.connection_); |
| + var Runtime = new goog.DevTools.Runtime(test.connection_); |
| + var bodyNode = {}; |
| + DOM.Enable(); |
|
Sami
2017/05/24 09:16:21
We should wait for this to finish I think.
alex clarke (OOO till 29th)
2017/05/24 11:38:16
Done.
|
| + DOM.OnChildNodeCountUpdated(function(params) { |
| + test.AssertEq(1, params.childNodeCount, "(params.childNodeCount)"); |
| + test.AssertEq(bodyNode.nodeId, params.nodeId, "(params.nodeId)"); |
| + test.Finish(); |
| + }); |
| + DOM.GetDocument({}).then(function(result) { |
| + bodyNode = result.root.children[0].children[1]; |
| + test.AssertEq("BODY", bodyNode.nodeName, "(bodyNode.nodeName)"); |
| + var div = document.createElement('div'); |
| + document.body.appendChild(div); |
| + }); |
| +}); |
| + |
| +goog.DevTools.TestHarness.RunTests(); |