| 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..66239a084325d74a56e0d409900c22c455fc17d3
|
| --- /dev/null
|
| +++ b/headless/test/bindings_test.js
|
| @@ -0,0 +1,37 @@
|
| +// 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().then(function() {
|
| + 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();
|
|
|