| 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..3b72d69b7194e0c96a4aa32b2df219c0693fcedf
|
| --- /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('chromium.DevTools.Connection');
|
| +goog.require('chromium.DevTools.DOM');
|
| +goog.require('chromium.DevTools.Runtime');
|
| +goog.provide('chromium.BindingsTest');
|
| +
|
| +/**
|
| + * Evaluates 1+1 and returns the result over the chromium.DevTools.Connection.
|
| + */
|
| +chromium.BindingsTest.evalOneAddOne = function() {
|
| + let connection = new chromium.DevTools.Connection(window.TabSocket);
|
| + let Runtime = new chromium.DevTools.Runtime(connection);
|
| + Runtime.Evaluate({'expression': '1+1'}).then(function(message) {
|
| + connection.sendDevToolsMessage(
|
| + '__Result',
|
| + {'result': JSON.stringify(message.result.value)});
|
| + });
|
| +};
|
| +
|
| +chromium.BindingsTest.listenForChildNodeCountUpdated = function() {
|
| + let connection = new chromium.DevTools.Connection(window.TabSocket);
|
| + let DOM = new chromium.DevTools.DOM(connection);
|
| + DOM.OnChildNodeCountUpdated(function(params) {
|
| + connection.sendDevToolsMessage('__Result',
|
| + {'result': JSON.stringify(params)});
|
| + });
|
| + DOM.Enable().then(function() {
|
| + DOM.GetDocument({}).then(function(result) {
|
| + // Create a new div which should trigger the event.
|
| + let div = document.createElement('div');
|
| + document.body.appendChild(div);
|
| + });
|
| + });
|
| +};
|
|
|