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

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

Issue 9741002: Adding file access permissions to fileBrowserHandler manifest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: .. Created 8 years, 9 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 38ffa8a6ad9aa5ee7361e92edc119099440bd504..f3ca29012e9899f40f104733880f6eee94f5ca84 100644
--- a/chrome/test/data/extensions/api_test/filebrowser_component/main.js
+++ b/chrome/test/data/extensions/api_test/filebrowser_component/main.js
@@ -20,13 +20,16 @@ var cleanupError = 'Got unexpected error while cleaning up test directory.';
// |fileVerifierFunction| method that will verify test results received from the
// filesystem_handler part of the test.
// The method will be passed received fileEntry object, original file
-// content, file content received from filesystem_handler and callback
+// content, response received from filesystem_handler and callback
// function that will expect error object as its argument (or undefined on
// success).
-var TestExpectations = function(expectedTasks, fileVerifierFunction) {
+// TODO(tbarzic): Rename this to TestParams, or something similar.
+var TestExpectations = function(fileExtension, expectedTasks,
+ fileVerifierFunction) {
this.fileText_ = undefined;
this.file_ = undefined;
this.expectedTasks_ = expectedTasks;
+ this.fileExtension_ = fileExtension;
this.fileVerifierFunction_ = fileVerifierFunction;
};
@@ -36,6 +39,10 @@ TestExpectations.prototype.setFileAndFileText = function(file, fileText) {
this.fileText_ = fileText;
};
+TestExpectations.prototype.getFileExtension = function() {
+ return this.fileExtension_;
+};
+
TestExpectations.prototype.verifyHandlerRequest = function(request, callback) {
if (!request) {
callback({message: "Request from handler not defined."});
@@ -53,7 +60,7 @@ TestExpectations.prototype.verifyHandlerRequest = function(request, callback) {
return;
}
- this.fileVerifierFunction_(this.file_, this.fileText_, request.fileContent,
+ this.fileVerifierFunction_(this.file_, this.fileText_, request,
callback);
};
@@ -118,10 +125,16 @@ TestRunner.prototype.onFileSystemFetched_ = function(fs) {
};
TestRunner.prototype.onFileCreatorInit_ = function() {
+ var ext = this.expectations_.getFileExtension();
+ if (!ext) {
+ this.errorCallback_({message: "Test file extension not set."});
+ return;
+ }
+console.log(this.fileExtension);
var self = this;
this.fileCreator_.createFile('.log',
function(file, text) {
- self.fileCreator_.createFile('.aBc',
+ self.fileCreator_.createFile(ext,
self.onFileCreated_.bind(self),
self.errorCallback_.bind(self));
},

Powered by Google App Engine
This is Rietveld 408576698