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

Unified Diff: Source/core/testing/Internals.js

Issue 360703003: Implement Blink-in-JS for DOM methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/testing/Internals.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.js
diff --git a/Source/core/testing/Internals.js b/Source/core/testing/Internals.js
new file mode 100644
index 0000000000000000000000000000000000000000..a30335c74888ed9367e021155b1246dc56ad6e07
--- /dev/null
+++ b/Source/core/testing/Internals.js
@@ -0,0 +1,89 @@
+// Copyright 2014 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.
+
+"use strict";
+
+installClass("Internals", function(global) {
+ var InternalsPrototype = Object.create(Element.prototype);
+
+ InternalsPrototype.doNothing = function() {
+ }
+
+ InternalsPrototype.return123 = function() {
+ return 123;
+ }
+
+ InternalsPrototype.echoInteger = function(value) {
+ return value;
+ }
+
+ InternalsPrototype.echoString = function(value) {
+ return value;
+ }
+
+ InternalsPrototype.echoNode = function(value) {
+ return value;
+ }
+
+ InternalsPrototype.addInteger = function(value1, value2) {
+ return value1 + value2;
+ }
+
+ InternalsPrototype.addString = function(value1, value2) {
+ return value1 + value2;
+ }
+
+ InternalsPrototype.setIntegerToDocument = function(document, value) {
+ document.integer = value;
+ }
+
+ InternalsPrototype.getIntegerFromDocument = function(document) {
+ return document.integer;
+ }
+
+ InternalsPrototype.setIntegerToPrototype = function(value) {
+ this.integer = value;
+ }
+
+ InternalsPrototype.getIntegerFromPrototype = function() {
+ return this.integer;
+ }
+
+ InternalsPrototype.createElement = function(document) {
+ return document.createElement("div");
+ }
+
+ InternalsPrototype.appendChild = function(node1, node2) {
+ node1.appendChild(node2);
+ }
+
+ InternalsPrototype.firstChild = function(node) {
+ return node.firstChild;
+ }
+
+ InternalsPrototype.nextSibling = function(node) {
+ return node.nextSibling;
+ }
+
+ InternalsPrototype.innerHTML = function(node) {
+ return node.innerHTML;
+ }
+
+ InternalsPrototype.setInnerHTML = function(node, string) {
+ node.innerHTML = string;
+ }
+
+ InternalsPrototype.addClickListener = function(node) {
+ node.addEventListener("click", function () {
+ node.innerHTML = "clicked";
+ });
+ }
+
+ InternalsPrototype.clickNode = function(document, node) {
+ var event = new MouseEvent("click", { bubbles: true, cancelable: true, view: global });
+ node.dispatchEvent(event);
+ }
+
+ return InternalsPrototype;
+});
« no previous file with comments | « Source/core/testing/Internals.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698