Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4701)

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/background.js

Issue 15809007: Clean up browser tests in Files.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed further comments. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698