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

Unified Diff: chrome/test/data/extensions/api_test/file_system_provider/write_file/test.js

Issue 677593002: [fsp] Fix flaky browser test for aborting a write operation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/file_system_provider/write_file/test.js
diff --git a/chrome/test/data/extensions/api_test/file_system_provider/write_file/test.js b/chrome/test/data/extensions/api_test/file_system_provider/write_file/test.js
index c51cfd1a5f79c693e73d698be16bbe9420d30b8c..0ec32ab7818450db247f3795fec8d91c4919ea23 100644
--- a/chrome/test/data/extensions/api_test/file_system_provider/write_file/test.js
+++ b/chrome/test/data/extensions/api_test/file_system_provider/write_file/test.js
@@ -49,15 +49,25 @@ var TESTING_BROKEN_TIRAMISU_FILE_NAME = 'broken-tiramisu.txt';
var TESTING_CHOCOLATE_FILE_NAME = 'chocolate.txt';
/**
+ * List of callbacks to be called when a file write is requested.
+ * @type {Array.<function(string)>}
+ */
+var writeFileRequestedCallbacks = [];
+
+/**
* Requests writing contents to a file, previously opened with <code>
* openRequestId</code>.
*
* @param {ReadFileRequestedOptions} options Options.
- * @param {function(} onSuccess Success callback.
+ * @param {function()} onSuccess Success callback.
* @param {function(string)} onError Error callback.
*/
function onWriteFileRequested(options, onSuccess, onError) {
var filePath = test_util.openedFiles[options.openRequestId];
+ writeFileRequestedCallbacks.forEach(function(callback) {
+ callback(filePath);
+ });
+
if (options.fileSystemId != test_util.FILE_SYSTEM_ID || !filePath) {
onError('SECURITY'); // enum ProviderError.
return;
@@ -350,12 +360,14 @@ function runTests() {
fileWriter.onabort = function(e) {
hadAbort = true;
};
+ writeFileRequestedCallbacks.push(
+ function(filePath) {
+ // Abort the operation after it's started.
+ if (filePath == '/' + TESTING_CHOCOLATE_FILE_NAME)
+ fileWriter.abort();
+ });
var blob = new Blob(['A lot of cherries.'], {type: 'text/plain'});
fileWriter.write(blob);
- setTimeout(function() {
- // Abort the operation after it's started.
- fileWriter.abort();
- }, 0);
},
function(error) {
chrome.test.fail();
« no previous file with comments | « chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698