Bug 1468754 Part 6: Add a test that the ChangesActor exists and has the expected methods.
MozReview-Commit-ID: 9uqR9PzvHZ4
new file mode 100644
--- /dev/null
+++ b/devtools/server/tests/mochitest/changes-data.html
@@ -0,0 +1,19 @@
+<html>
+<script>
+ "use strict";
+
+ window.onload = () => {
+ window.opener.postMessage("ready", "*");
+ };
+</script>
+<style>
+#first {
+ color: blue;
+}
+</style>
+<body>
+<h1>Changes Actor Tests</h1>
+
+<div id="first">This text is in the first div.</div>
+</body>
+</html>
--- a/devtools/server/tests/mochitest/chrome.ini
+++ b/devtools/server/tests/mochitest/chrome.ini
@@ -1,13 +1,14 @@
[DEFAULT]
tags = devtools
skip-if = os == 'android'
support-files =
animation-data.html
+ changes-data.html
doc_Debugger.Source.prototype.introductionType.xul
Debugger.Source.prototype.element.js
Debugger.Source.prototype.element-2.js
Debugger.Source.prototype.element.html
hello-actor.js
iframe1_makeGlobalObjectReference.html
iframe2_makeGlobalObjectReference.html
inspector_css-properties.html
@@ -27,16 +28,17 @@ support-files =
nonchrome_unsafeDereference.html
small-image.gif
setup-in-child.js
setup-in-parent.js
webconsole-helpers.js
webextension-helpers.js
[test_animation_actor-lifetime.html]
[test_animation-type-longhand.html]
+[test_changes-functions.html]
[test_connection-manager.html]
skip-if = (verify && debug && (os == 'win'))
[test_connectToFrame.html]
[test_css-logic.html]
[test_css-logic-media-queries.html]
[test_css-logic-specificity.html]
[test_css-properties.html]
[test_Debugger.Source.prototype.introductionScript.html]
new file mode 100644
--- /dev/null
+++ b/devtools/server/tests/mochitest/test_changes-functions.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test for Bug 1468754 - ChangesActor functions</title>
+<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
+<script type="application/javascript" src="inspector-helpers.js"></script>
+<script type="application/javascript">
+"use strict";
+
+window.onload = function() {
+ SimpleTest.waitForExplicitFinish();
+ runNextTest();
+};
+
+let gChanges = null;
+
+addTest(function() {
+ const url = document.getElementById("changesContent").href;
+ attachURL(url, async function(err, client, tab, doc) {
+ const {InspectorFront} = require("devtools/shared/fronts/inspector");
+ const inspector = InspectorFront(client, tab);
+ gChanges = await inspector.getChanges();
+ info("gChanges is " + gChanges + ".");
+ runNextTest();
+ });
+});
+
+addTest(function() {
+ // Test that the ChangesActor exists, and has the expected methods.
+ ok(gChanges, "The ChangesActor exists.");
+
+ const methodsShouldExist = [
+ "change",
+ "changes",
+ "pushStylesheetChange",
+ "pushAttributeChange",
+ "popChange",
+ "clearChanges",
+ ];
+
+ for (const method of methodsShouldExist) {
+ ok(gChanges[method], "The ChangesActor has a " + method + " method.");
+ }
+
+ // Clean up.
+ gChanges = null;
+ runNextTest();
+});
+
+</script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1468754">Mozilla Bug 1468754</a>
+<a id="changesContent" target="_blank" href="changes-data.html">Test Document</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+</pre>
+</body>
+</html>