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

Unified Diff: chrome/test/data/extensions/api_test/filebrowser_component/write.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/write.js
diff --git a/chrome/test/data/extensions/api_test/filebrowser_component/write.js b/chrome/test/data/extensions/api_test/filebrowser_component/write.js
index a76a2a7db0cd1bf9a114170fc4a5e9dc8776d73a..e40a682335504d65086015fd89adb18139148c6e 100644
--- a/chrome/test/data/extensions/api_test/filebrowser_component/write.js
+++ b/chrome/test/data/extensions/api_test/filebrowser_component/write.js
@@ -5,11 +5,11 @@
// Checks that filesystem_handler read the file correctly (original and received
// text match) and changed its content in expected way (file should contain
// originalText + originalText).
-function verifyFileContent(file, originalText, receivedText, callback) {
- if (receivedText != originalText) {
+function verifyFileContent(file, originalText, request, callback) {
+ if (request.fileContent != originalText) {
callback({message:'Received content does not match. ' +
'Expected: "' + originalText + '", ' +
- 'Got "' + receivedText + '".'});
+ 'Got "' + request.fileContent + '".'});
return;
}
@@ -27,10 +27,34 @@ function verifyFileContent(file, originalText, receivedText, callback) {
callback);
};
+function getFileExtensionFromLocationHref() {
+ var loc = window.location.href;
+ console.log("Opening tab " + loc);
+ if (loc.indexOf("#") == -1 ) {
+ console.log("No params in url, faling back to default.");
+ return undefined;
+ }
+
+ loc = unescape(loc.substr(loc.indexOf("#") + 1));
+ return loc;
+}
+
+function createTestExpectations(defaultFileExtension) {
+ var fileExtension = getFileExtensionFromLocationHref();
+ if (!fileExtension)
+ fileExtension = defaultFileExtension;
+
+ var fileActionName = 'TestAction_' + fileExtension;
+ var fileActionFilter = ['filesystem:*.' + fileExtension.toLowerCase()];
+ var expectedTasks = {};
+ expectedTasks[fileActionName] = fileActionFilter;
+ fileExtension = '.' + fileExtension;
+
+ return new TestExpectations(fileExtension, expectedTasks, verifyFileContent);
+}
+
chrome.test.runTests([function tab() {
- var expectedTasks = {'AbcAction': ['filesystem:*.abc'],
- 'BaseAction': ['filesystem:*', 'filesystem:*.*']};
- var expectations = new TestExpectations(expectedTasks, verifyFileContent);
+ var expectations = createTestExpectations('aBc');
var testRunner = new TestRunner(expectations);
testRunner.runTest();

Powered by Google App Engine
This is Rietveld 408576698