aboutsummaryrefslogtreecommitdiff
path: root/src/js/selenium
diff options
context:
space:
mode:
authorGravatar Rogan Creswick <creswick@gmail.com>2013-06-13 12:06:09 -0700
committerGravatar Rogan Creswick <creswick@gmail.com>2013-06-13 12:06:09 -0700
commit0dcf39a7de6ddb09011e25ec5a1a6ebcff2f1fc5 (patch)
tree89bbccaba73c35bfec1f4c108d92d66d56a63ef9 /src/js/selenium
parent9683b9b075ce96ba0477f7ee746246dba178c25e (diff)
added more semantically rich tests to headless test, and fixed the bugs that those revealed re: the new rule/ruleset formats
Diffstat (limited to 'src/js/selenium')
-rw-r--r--src/js/selenium/selenium-injected-compute.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/js/selenium/selenium-injected-compute.js b/src/js/selenium/selenium-injected-compute.js
index dd208be..e6a8b59 100644
--- a/src/js/selenium/selenium-injected-compute.js
+++ b/src/js/selenium/selenium-injected-compute.js
@@ -19,11 +19,13 @@
* limitations under the License.
*/
+
+
/**
* @return {{on: function(!string, function(*)), emit: function(!string, *)}}
*/
var obtainComputePort = function() {
- fiveui.selPort = new fiveui.SeleniumPort();
+
return fiveui.selPort;
};
@@ -61,7 +63,8 @@ fiveui.SeleniumPort.prototype.emit = function(evt, obj) {
* Send a message to the injected script.
*
* @param {!string} evt The event to fire.
- * @param {?Object} obj The data to associate with the event.
+ * @param {?Array.<string>} obj The data to associate with the event
+ * (an array of strings, each representing a JS module)
*/
fiveui.SeleniumPort.prototype.send = function(evt, obj) {
if (this._events[evt]) {
@@ -81,8 +84,7 @@ fiveui.SeleniumPort.prototype.query = function (type) {
if (!type) {
msgs = this._messages;
- }
- else {
+ } else {
for (i=0; i < this._messages.length; i += 1) {
console.log(this._messages);
if (this._messages[i].type === type) {
@@ -97,3 +99,9 @@ fiveui.SeleniumPort.prototype.query = function (type) {
// return the new messages to the backend:
return msgs;
};
+
+// Define a port at the top level, so multiple contexts can access it.
+fiveui.selPort = new fiveui.SeleniumPort();
+// fiveui.selPort.emit('ReportProblem', {name: 'foo'});
+
+// this._messages = [{type: 'ReportProblem', payload: {name: 'bork'}}];