| Index: chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| index bc60f6fb58f86668d2c4e8440117945320275a24..375f6cf4c24a8a2361e711f02c1eac821eb24e4a 100644
|
| --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| @@ -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.
|
|
|