Chromium Code Reviews| 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..3fccf6df9b74658c586368b0cb48131b2fddb0be 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,41 @@ 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_ = []; |
| +} |
| + |
| +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); |
| + this.steps_.push(function() {}); |
|
hirono
2013/05/30 04:46:10
How about putting 'checkIfNoErrorsOccured' here?
mtomasz
2013/05/30 06:40:53
I was thinking about, however I thought that putti
hirono
2013/05/30 07:08:59
I'm not sure, but StepsRunner already have the rol
mtomasz
2013/05/30 07:30:11
Hm, callbackPass is just a utility to make tests w
hashimoto
2013/05/30 08:21:45
I feel neutral about this point.
Making StepsRunne
mtomasz
2013/05/30 08:51:26
That's a good idea. I will write a utility which a
|
| + this.steps_ = this.steps_.map(function(f) { |
| + return chrome.test.callbackPass(f); |
| + }); |
| + this.next(); |
| +}; |
| + |
| chrome.test.runTests([ |
| // Waits for the C++ code to send a string identifying a test, then runs that |
| // test. |