Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 712643 - land Marionette on m-c. r=mossop,robcee
Browse files Browse the repository at this point in the history
  • Loading branch information
jmaher committed Mar 22, 2012
1 parent 62c9219 commit 1ee1ef7
Show file tree
Hide file tree
Showing 25 changed files with 3,053 additions and 1 deletion.
8 changes: 8 additions & 0 deletions allmakefiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ if [ "$COMPILER_DEPEND" = "" -a "$MOZ_NATIVE_MAKEDEPEND" = "" ]; then
"
fi

if [ "$ENABLE_MARIONETTE" ]; then
add_makefiles "
testing/marionette/Makefile
testing/marionette/components/Makefile
testing/marionette/tests/Makefile
"
fi

if [ "$ENABLE_TESTS" ]; then
add_makefiles "
build/autoconf/test/Makefile
Expand Down
4 changes: 4 additions & 0 deletions b2g/app/b2g.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ pref("ril.data.apn", "");
pref("ril.data.user", "");
pref("ril.data.passwd", "");

//Enable/disable marionette server, set listening port
pref("marionette.defaultPrefs.enabled", true);
pref("marionette.defaultPrefs.port", 2828);

#ifdef MOZ_UPDATER
pref("app.update.enabled", true);
pref("app.update.auto", true);
Expand Down
2 changes: 1 addition & 1 deletion b2g/confvars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
# MOZ_APP_DISPLAYNAME is set by branding/configure.sh

MOZ_SAFE_BROWSING=
MOZ_SERVICES_SYNC=
MOZ_SERVICES_SYNC=1

MOZ_WEBSMS_BACKEND=1
MOZ_DISABLE_DOMCRYPTO=1
Expand Down
4 changes: 4 additions & 0 deletions b2g/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,10 @@ bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
@BINPATH@/components/B2GComponents.manifest
@BINPATH@/components/B2GComponents.xpt
@BINPATH@/components/CameraContent.js
@BINPATH@/chrome/marionette@JAREXT@
@BINPATH@/chrome/marionette.manifest
@BINPATH@/components/MarionetteComponents.manifest
@BINPATH@/components/marionettecomponent.js
@BINPATH@/components/AlertsService.js
@BINPATH@/components/ContentPermissionPrompt.js
#ifdef MOZ_UPDATER
Expand Down
1 change: 1 addition & 0 deletions config/autoconf.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ MOZ_LIBSTDCXX_HOST_VERSION=@MOZ_LIBSTDCXX_HOST_VERSION@
INCREMENTAL_LINKER = @INCREMENTAL_LINKER@
MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
ENABLE_TESTS = @ENABLE_TESTS@
ENABLE_MARIONETTE = @ENABLE_MARIONETTE@
IBMBIDI = @IBMBIDI@
MOZ_UNIVERSALCHARDET = @MOZ_UNIVERSALCHARDET@
ACCESSIBILITY = @ACCESSIBILITY@
Expand Down
9 changes: 9 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -6437,6 +6437,14 @@ MOZ_ARG_DISABLE_BOOL(tests,
ENABLE_TESTS=,
ENABLE_TESTS=1 )

dnl ========================================================
dnl Marionette
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(marionette,
[ --enable-marionette Enable Marionette for remote testing and control],
ENABLE_MARIONETTE=1,
ENABLE_MARIONETTE)

dnl ========================================================
dnl parental controls (for Windows Vista)
dnl ========================================================
Expand Down Expand Up @@ -8381,6 +8389,7 @@ AC_SUBST(JAR)
AC_SUBST(MOZ_PROFILELOCKING)

AC_SUBST(ENABLE_TESTS)
AC_SUBST(ENABLE_MARIONETTE)
AC_SUBST(IBMBIDI)
AC_SUBST(MOZ_UNIVERSALCHARDET)
AC_SUBST(ACCESSIBILITY)
Expand Down
19 changes: 19 additions & 0 deletions testing/marionette/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

ifdef ENABLE_MARIONETTE
DIRS += components
ifdef ENABLE_TESTS
DIRS += tests
endif
endif

include $(topsrcdir)/config/rules.mk
17 changes: 17 additions & 0 deletions testing/marionette/components/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.

DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

EXTRA_PP_COMPONENTS = \
MarionetteComponents.manifest \
marionettecomponent.js \
$(NULL)

include $(topsrcdir)/config/rules.mk
4 changes: 4 additions & 0 deletions testing/marionette/components/MarionetteComponents.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Marionette
component {786a1369-dca5-4adc-8486-33d23c88010a} marionettecomponent.js
contract @mozilla.org/marionette;1 {786a1369-dca5-4adc-8486-33d23c88010a}
category profile-after-change MarionetteComponent @mozilla.org/marionette;1
89 changes: 89 additions & 0 deletions testing/marionette/components/marionettecomponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

const {classes: Cc, interfaces: Ci, utils: Cu} = Components;

const MARIONETTE_CONTRACTID = "@mozilla.org/marionette;1";
const MARIONETTE_CID = Components.ID("{786a1369-dca5-4adc-8486-33d23c88010a}");

Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");

function MarionetteComponent() {
this._loaded = false;
}

MarionetteComponent.prototype = {
classDescription: "Marionette component",
classID: MARIONETTE_CID,
contractID: MARIONETTE_CONTRACTID,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
_xpcom_categories: [{category: "profile-after-change", service: true}],

observe: function mc_observe(aSubject, aTopic, aData) {
let observerService = Services.obs;
switch (aTopic) {
case "profile-after-change":
if (Services.prefs.getBoolPref('marionette.defaultPrefs.enabled')) {
// set up the logger
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/services-sync/log4moz.js");

let logger = Log4Moz.repository.getLogger("Marionette");
logger.level = Log4Moz.Level["All"];
let logf = FileUtils.getFile('ProfD', ['marionette.log']);

let formatter = new Log4Moz.BasicFormatter();
logger.addAppender(new Log4Moz.FileAppender(logf, formatter));
logger.info("MarionetteComponent loaded");

//add observers
observerService.addObserver(this, "final-ui-startup", false);
observerService.addObserver(this, "xpcom-shutdown", false);
}
else {
logger.info("marionette not enabled");
}
break;
case "final-ui-startup":
observerService.removeObserver(this, "final-ui-startup");
this.init();
break;
case "xpcom-shutdown":
observerService.removeObserver(this, "xpcom-shutdown");
this.uninit();
break;
}
},

init: function mc_init() {
if (!this._loaded) {
this._loaded = true;
let port;
try {
port = Services.prefs.getIntPref('marionette.defaultPrefs.port');
}
catch(e) {
port = 2828;
}
try {
Cu.import('resource:///modules/devtools/dbg-server.jsm');
DebuggerServer.addActors('chrome://marionette/content/marionette-actors.js');
DebuggerServer.initTransport();
DebuggerServer.openListener(port, true);
}
catch(e) {
logger.error('exception: ' + e.name + ', ' + e.message);
}
}
},

uninit: function mc_uninit() {
DebuggerServer.closeListener();
this._loaded = false;
},

};

const NSGetFactory = XPCOMUtils.generateNSGetFactory([MarionetteComponent]);
7 changes: 7 additions & 0 deletions testing/marionette/jar.mn
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
marionette.jar:
% content marionette %content/
content/marionette-actors.js (marionette-actors.js)
content/marionette-listener.js (marionette-listener.js)
content/marionette-elements.js (marionette-elements.js)
content/marionette-log-obj.js (marionette-log-obj.js)
content/marionette-simpletest.js (marionette-simpletest.js)
Loading

0 comments on commit 1ee1ef7

Please sign in to comment.