Permalink
Browse files

Fixes robot tests on IE7.

  • Loading branch information...
1 parent 02df359 commit 641e751a851d757ec050730f6ad66aa823e13b81 @divdavem divdavem committed Nov 13, 2012
Showing with 18 additions and 4 deletions.
  1. +15 −1 src/aria/jsunit/Robot.js
  2. +3 −3 src/aria/jsunit/RobotTestCase.js
View
@@ -237,6 +237,20 @@ Aria.classDefinition({
VK_Z : 90
},
$prototype : {
+
+ /**
+ * Return true if the robot is most likely usable (Java enabled).
+ */
+ isUsable : function () {
+ var navigator = Aria.$window.navigator;
+ try {
+ var res = navigator && navigator.javaEnabled();
+ return !!res;
+ } catch (e) {
+ return false;
+ }
+ },
+
/**
* Initialize the robot, if not already done. This must be called before any other method on the robot.
* @param {aria.core.CfgBeans.Callback} callback callback to be called when the robot is ready to be used.
@@ -340,7 +354,7 @@ Aria.classDefinition({
if (position.x < 0 || position.y < 0 || position.x > viewport.width || position.y > viewport.height) {
// FIXME: log error correctly
this.$logWarn("MouseMove position outside of the viewport.");
- //return;
+ // return;
}
this._updateAppletPosition({
fn : this._mouseMoveCb,
@@ -40,9 +40,9 @@ Aria.classDefinition({
if (this.skipTest) {
this.$TemplateTestCase.run.call(this);
} else {
- var navigator = Aria.$window.navigator;
- if (navigator && navigator.javaEnabled && navigator.javaEnabled()) {
- aria.jsunit.Robot.initRobot({
+ var robot = aria.jsunit.Robot;
+ if (robot.isUsable()) {
+ robot.initRobot({
fn : this.$TemplateTestCase.run,
scope : this
});

0 comments on commit 641e751

Please sign in to comment.