Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Unified Diff: headless/test/bindings_test.js

Issue 2902583002: Add some closureised JS bindings for DevTools for use by headless embedder (Closed)
Patch Set: Don't run the test on windows because js_binary doesn't work Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698