Commit 6b694cf8 authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

Clean up browser tests in Files.app.

This patch cleans up tests on the Javascript side for Files.app:
- Introduce a StepRunner, which runs multi-step test cases.
- Add checking for Javascript errors after each test case.
- Add missing comments.

TEST=browser_tests
BUG=244327

Review URL: https://chromiumcodereview.appspot.com/15809007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203123 0039d316-1c4b-4281-b951-d872f2087c98
parent f353f6b6
......@@ -28,6 +28,54 @@ function callRemoteTestUtil(func, appId, args, callback) {
callback);
}
/**
* Executes a sequence of test steps.
* @constructor
*/
function StepsRunner() {
/**
* List of steps.
* @type {Array.function>}
* @private
*/
this.steps_ = [];
}
/**
* Creates a StepsRunner instance and runs the passed steps.
*/
StepsRunner.run = function(steps) {
var stepsRunner = new StepsRunner();
stepsRunner.run_(steps);
};
StepsRunner.prototype = {
/**
* @return {function} The next closure.
*/
get next() {
return this.steps_.shift();
}
};
/**
* Runs a sequence of the added test steps.
* @type {Array.<function>} List of the sequential steps.
*/
StepsRunner.prototype.run_ = function(steps) {
this.steps_ = steps.slice(0);
// An extra step which acts as an empty callback for optional asynchronous
// calls in the last provided step.
this.steps_.push(function() {});
this.steps_ = this.steps_.map(function(f) {
return chrome.test.callbackPass(f.bind(this));
}.bind(this));
this.next();
};
chrome.test.runTests([
// Waits for the C++ code to send a string identifying a test, then runs that
// test.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment