Index: chrome/common/extensions/docs/examples/apps/cycler/cycler.js |
diff --git a/chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js b/chrome/common/extensions/docs/examples/apps/cycler/cycler.js |
similarity index 66% |
copy from chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js |
copy to chrome/common/extensions/docs/examples/apps/cycler/cycler.js |
index c43b864d8566ae0ace65c0cb0c6fc7d3a4995900..19132881ca16b3142e61f7ad1acaabc7b2070d84 100644 |
--- a/chrome/common/extensions/docs/examples/api/record/page_cycler/page_cycler.js |
+++ b/chrome/common/extensions/docs/examples/apps/cycler/cycler.js |
@@ -6,9 +6,7 @@ function $(criterion) { |
return document.querySelector(criterion); |
} |
-var pageCyclerUI = new (function () { |
- var noTestMessage = "N/A -- do Prepare Test"; |
- |
+var cyclerUI = new (function () { |
this.urlList = []; |
this.cacheDir = ""; |
@@ -18,15 +16,15 @@ var pageCyclerUI = new (function () { |
this.captureErrorDiv = $("#capture-errors-display"); |
this.captureErrorList = $("#capture-errors"); |
- this.replayTab = $("#replay-tab"); |
- this.replayTabLabel = $("#replay-tab-label"); |
- this.replayURLs = $("#replay-urls"); |
- this.replayCache = $("#replay-cache-dir"); |
- this.replayButton = $("#replay-test"); |
- this.replayErrorDiv = $("#replay-errors-display"); |
- this.replayErrorList = $("#replay-errors"); |
+ this.playbackTab = $("#playback-tab"); |
+ this.playbackTabLabel = $("#playback-tab-label"); |
+ this.playbackURLs = $("#playback-urls"); |
+ this.playbackCache = $("#playback-cache-dir"); |
+ this.playbackButton = $("#playback-test"); |
+ this.playbackErrorDiv = $("#playback-errors-display"); |
+ this.playbackErrorList = $("#playback-errors"); |
- this.replayURLs.innerText = this.replayCache.innerText = noTestMessage; |
+ this.playbackURLs.innerText = this.playbackCache.innerText = noTestMessage; |
this.enableTab = function(tabLabel, tab) { |
var tabList = document.querySelectorAll(".tab"); |
@@ -53,7 +51,7 @@ var pageCyclerUI = new (function () { |
} |
this.chooseReplay = function() { |
- this.enableTab(this.replayTabLabel, this.replayTab); |
+ this.enableTab(this.playbackTabLabel, this.playbackTab); |
} |
this.captureTest = function() { |
@@ -81,18 +79,19 @@ var pageCyclerUI = new (function () { |
if (errors.length > 0) { |
this.captureErrorList.innerText = errors.join("\n"); |
this.captureErrorDiv.className = "error-list-show"; |
- this.replayButton.disabled = true; |
- this.replayCache.innerText = this.replayURLs.innerText = noTestMessage; |
+ this.playbackButton.disabled = true; |
+ this.playbackCache.innerText = this.playbackURLs.innerText = |
+ noTestMessage; |
} |
else { |
this.captureErrorDiv.className = "error-list-hide"; |
- this.replayButton.disabled = false; |
- this.replayURLs.innerText = this.urlList.join("\n"); |
- this.replayCache.innerText = this.cacheDir; |
+ this.playbackButton.disabled = false; |
+ this.playbackURLs.innerText = this.urlList.join("\n"); |
+ this.playbackCache.innerText = this.cacheDir; |
} |
} |
- this.replayTest = function() { |
+ this.playbackTest = function() { |
var extensionPath = $("#extension-dir").value; |
var repeatCount = parseInt($('#repeat-count').value); |
var errors = []; |
@@ -104,12 +103,12 @@ var pageCyclerUI = new (function () { |
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"; |
+ this.playbackErrorList.innerText = errors.join("\n"); |
+ this.playbackErrorDiv.className = "error-list-show"; |
} else { |
- this.replayErrorDiv.className = "error-list-hide"; |
- this.replayButton.disabled = true; |
- chrome.experimental.record.replayURLs( |
+ this.playbackErrorDiv.className = "error-list-hide"; |
+ this.playbackButton.disabled = true; |
+ chrome.experimental.record.playbackURLs( |
this.urlList, |
this.cacheDir, |
repeatCount, |
@@ -119,25 +118,25 @@ var pageCyclerUI = new (function () { |
} |
this.onReplayDone = function(result) { |
- var replayResult = $("#replay-result"); |
+ var playbackResult = $("#playback-result"); |
- this.replayButton.disabled = false; |
+ this.playbackButton.disabled = false; |
if (result.errors.length > 0) { |
- this.replayErrorList.innerText = result.errors.join("<br>"); |
- this.replayErrorDiv.className = "error-list-show"; |
+ this.playbackErrorList.innerText = result.errors.join("<br>"); |
+ this.playbackErrorDiv.className = "error-list-show"; |
} |
else { |
- this.replayErrorDiv.className = "error-list-hide"; |
- replayResult.innerText = "Test took " + result.runTime + "mS :\n" + |
+ this.playbackErrorDiv.className = "error-list-hide"; |
+ playbackResult.innerText = "Test took " + result.runTime + "mS :\n" + |
result.stats; |
} |
} |
this.captureButton.addEventListener("click", this.captureTest.bind(this)); |
- this.replayButton.addEventListener("click", this.replayTest.bind(this)); |
+ this.playbackButton.addEventListener("click", this.playbackTest.bind(this)); |
this.captureTabLabel.addEventListener("click", this.chooseCapture.bind(this)); |
- this.replayTabLabel.addEventListener("click", this.chooseReplay.bind(this)); |
+ this.playbackTabLabel.addEventListener("click", this.chooseReplay.bind(this)); |
this.enableTab(this.captureTabLabel, this.captureTab); |
})(); |