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

Unified Diff: chrome/test/data/extensions/api_test/filebrowser_component/main.js

Issue 10834383: Chrome OS "open with" picker allowing Web Intents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: tiny 80 chars fix Created 8 years, 3 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/test/data/extensions/api_test/filebrowser_component/main.js
diff --git a/chrome/test/data/extensions/api_test/filebrowser_component/main.js b/chrome/test/data/extensions/api_test/filebrowser_component/main.js
index 66505717695040373dc1d6ac2cfeb142e91f45f6..10343a7aba493768f27996018d1952b397421c8d 100644
--- a/chrome/test/data/extensions/api_test/filebrowser_component/main.js
+++ b/chrome/test/data/extensions/api_test/filebrowser_component/main.js
@@ -67,6 +67,46 @@ TestExpectations.prototype.verifyHandlerRequest = function(request, callback) {
callback);
};
+TestExpectations.prototype.hasVerifyStep = function() {
+ return !!this.fileVerifierFunction_;
+};
+
+// Verifies that list of tasks |tasks| contains tasks specified in
+// expectedTasks_. |successCallback| expects to be passed |tasks|.
+// |errorCallback| expects error object.
+TestExpectations.prototype.verifyTasks = function(tasks,
+ successCallback,
+ errorCallback) {
+ if (tasks.length != Object.keys(this.expectedTasks_).length) {
+ errorCallback({message: 'Wrong number of tasks found.'});
+ return;
+ }
+
+ for (var i = 0; i < tasks.length; ++i) {
+ var taskName = /^.*[|]\d+[|](\S+)$/.exec(tasks[i].taskId)[1];
+ var patterns = tasks[i].patterns;
+ var expectedPatterns = this.expectedTasks_[taskName];
+ if (!expectedPatterns) {
+ errorCallback({message: 'Wrong task from getFileTasks(): ' + taskName});
tbarzic 2012/09/11 02:01:40 this function has been removed when "patterns" wer
thorogood 2012/09/13 02:34:49 Cool, that makes sense. Yeah - I wondered about "p
+ return;
+ }
+ patterns = patterns.sort();
+ expectedPatterns = expectedPatterns.sort();
+ for (var j = 0; j < patterns.length; ++j) {
+ var translatedPattern = expectedPatterns[j].replace(
+ /^filesystem:/, "chrome-extension://*/");
+ if (patterns[j] != translatedPattern) {
+ errorCallback({message: 'Wrong patterns set for task ' +
+ taskName + '. ' +
+ 'Got: ' + patterns +
+ ' expected: ' + expectedPatterns});
+ return;
+ }
+ }
+ }
+ successCallback(tasks);
+};
+
// Class that is in charge for running the test.
var TestRunner = function(expectations) {
this.expectations_ = expectations;
@@ -99,7 +139,6 @@ TestRunner.prototype.onFileCreatorInit_ = function() {
this.errorCallback_({message: "Test file extension not set."});
return;
}
- console.log(this.fileExtension);
var self = this;
this.fileCreator_.createFile('.log',
function(file, text) {
@@ -132,6 +171,11 @@ TestRunner.prototype.onGetTasks_ = function(fileUrl, tasks) {
tasks = this.filterTasks_(tasks);
chrome.fileBrowserPrivate.executeTask(tasks[0].taskId, [fileUrl]);
+
+ if (!this.expectations_.hasVerifyStep()) {
tbarzic 2012/09/13 04:29:16 I think you still need something like this (TestRu
thorogood 2012/09/13 08:14:04 I'm not sure - my test intent handler does in fact
tbarzic 2012/09/13 18:44:45 yeah, but the problem is files created during the
+ console.log('Not verifying content, succeed immediately.');
+ this.reportSuccess_();
+ }
};
TestRunner.prototype.filterTasks_ = function(tasks) {

Powered by Google App Engine
This is Rietveld 408576698