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

Unified Diff: chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js

Issue 10386134: Record API fix adding FirstRun, and allowing repeat-count in capture (plus some browsertests along … (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Retrying due to patch failure Created 8 years, 6 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
Index: chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js
diff --git a/chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js b/chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js
index e6fca8bba79b140903e8783af79a3651c7737ce3..177ad85a92d0cbb63d52355912867c3976adbd4f 100644
--- a/chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js
+++ b/chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js
@@ -15,10 +15,13 @@ var pageCyclerUI = new (function () {
this.captureTab = $("#capture-tab");
this.captureTabLabel = $("#capture-tab-label");
this.captureButton = $("#capture-test");
+ this.captureErrorDiv = $("#capture-errors-display");
+ this.captureErrorList = $("#capture-errors");
this.replayTab = $("#replay-tab");
this.replayTabLabel = $("#replay-tab-label");
this.replayURLs = $("#replay-urls");
+ this.replayRepeatCount = $("#replay-repeat-count");
this.replayCache = $("#replay-cache-dir");
this.replayButton = $("#replay-test");
this.replayErrorDiv = $("#replay-errors-display");
@@ -55,56 +58,58 @@ var pageCyclerUI = new (function () {
}
this.captureTest = function() {
+ var errorList = $("#capture-errors");
+ var errors = [];
+
this.cacheDir = $("#capture-cache-dir").value;
this.urlList = $("#capture-urls").value.split("\n");
+ this.repeatCount = parseInt($("#capture-repeat-count").value);
- this.captureButton.disabled = true;
- chrome.experimental.record.captureURLs(this.urlList, this.cacheDir,
- this.onCaptureDone.bind(this));
+ // Check local errors
+ if (isNaN(this.repeatCount))
+ errors.push("Enter a number for repeat count");
+ else if (this.repeatCount < 1 || this.repeatCount > 100)
+ errors.push("Repeat count must be between 1 and 100");
+
+ if (errors.length > 0) {
+ this.captureErrorList.innerText = errors.join("\n");
+ this.captureErrorDiv.className = "error-list-show";
+ }
+ else {
+ this.captureErrorDiv.className = "error-list-hide";
+ this.captureButton.disabled = true;
+ chrome.experimental.record.captureURLs(this.urlList, this.cacheDir,
+ this.repeatCount, this.onCaptureDone.bind(this));
+ }
}
this.onCaptureDone = function(errors) {
- var errorDiv = $("#capture-errors-display");
- var errorList = $("#capture-errors");
this.captureButton.disabled = false;
if (errors.length > 0) {
- errorList.innerText = errors.join("\n");
- errorDiv.className = "error-list-show";
+ this.captureErrorList.innerText = errors.join("\n");
+ this.captureErrorDiv.className = "error-list-show";
this.replayButton.disabled = true;
this.replayCache.innerText = this.replayURLs.innerText = noTestMessage;
}
else {
- errorDiv.className = "error-list-hide";
+ this.captureErrorDiv.className = "error-list-hide";
this.replayButton.disabled = false;
this.replayURLs.innerText = this.urlList.join("\n");
this.replayCache.innerText = this.cacheDir;
+ this.replayRepeatCount.innerText = this.repeatCount;
}
}
this.replayTest = function() {
- var repeatCount = parseInt($("#repeat-count").value);
var extensionPath = $("#extension-dir").value;
var errors = [];
- // Check local errors
- if (isNaN(repeatCount))
- errors.push("Enter a number for repeat count");
- else if (repeatCount < 1 || repeatCount > 100)
- errors.push("Repeat count must be between 1 and 100");
-
- if (errors.length > 0) {
- this.replayErrorList.innerText = errors.join("\n");
- this.replayErrorDiv.className = "error-list-show";
- } else {
- this.replayErrorDiv.className = "error-list-hide";
- this.replayButton.disabled = true;
+ this.replayButton.disabled = true;
- chrome.experimental.record.replayURLs(this.urlList, this.cacheDir, {
- "extensionPath": extensionPath,
- "repeatCount": repeatCount
+ chrome.experimental.record.replayURLs(this.urlList, this.cacheDir,
+ this.repeatCount, {"extensionPath": extensionPath
}, this.onReplayDone.bind(this));
- }
}
this.onReplayDone = function(result) {

Powered by Google App Engine
This is Rietveld 408576698