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

Unified Diff: chrome/test/data/extensions/api_test/media_galleries/copy_to_access/no_access/copy_to_common.js

Issue 22895002: Media Galleries API: Fix CopyTo test flaky timeout on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/extensions/api/media_galleries/media_galleries_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/media_galleries/copy_to_access/no_access/copy_to_common.js
diff --git a/chrome/test/data/extensions/api_test/media_galleries/copy_to_access/no_access/copy_to_common.js b/chrome/test/data/extensions/api_test/media_galleries/copy_to_access/no_access/copy_to_common.js
index 50b11971ae3f6284570ba69075407be83b1d8d3c..7e35e95406f03c7f707a62141f91adf9101263d1 100644
--- a/chrome/test/data/extensions/api_test/media_galleries/copy_to_access/no_access/copy_to_common.js
+++ b/chrome/test/data/extensions/api_test/media_galleries/copy_to_access/no_access/copy_to_common.js
@@ -4,18 +4,24 @@
var mediaGalleries = chrome.mediaGalleries;
-function getOnwriteendCallbackExpectFailure(testImageFileEntry, galleries) {
+function getOnwriteendCallbackExpectFailure(testImageFileEntry, galleries,
+ filename) {
return function() {
- testImageFileEntry.copyTo(galleries[0].root, this.filename,
+ testImageFileEntry.copyTo(
+ galleries[0].root,
+ filename,
chrome.test.fail,
- chrome.test.callbackPass(function() {}));
+ chrome.test.succeed);
};
}
-function getOnwriteendCallbackExpectSuccess(testImageFileEntry, galleries) {
+function getOnwriteendCallbackExpectSuccess(testImageFileEntry, galleries,
+ filename) {
return function() {
- testImageFileEntry.copyTo(galleries[0].root, this.filename,
- chrome.test.callbackPass(function() {}),
+ testImageFileEntry.copyTo(
+ galleries[0].root,
+ filename,
+ chrome.test.succeed,
chrome.test.fail);
};
}
@@ -39,8 +45,7 @@ function runTest(testCase, getOnwriteendCallback) {
var testImageFileEntry;
function getMediaFileSystemsList() {
- mediaGalleries.getMediaFileSystems(
- chrome.test.callbackPass(testGalleries));
+ mediaGalleries.getMediaFileSystems(testGalleries);
}
function testGalleries(results) {
@@ -50,21 +55,19 @@ function runTest(testCase, getOnwriteendCallback) {
// Create a temporary file system and an image for copying-into test.
window.webkitRequestFileSystem(window.TEMPORARY, 1024*1024,
- chrome.test.callbackPass(temporaryFileSystemCallback),
- chrome.test.fail);
+ temporaryFileSystemCallback,
+ chrome.test.fail);
}
function temporaryFileSystemCallback(filesystem) {
filesystem.root.getFile(testCase.filename, {create:true, exclusive: false},
- chrome.test.callbackPass(temporaryImageCallback),
- chrome.test.fail);
+ temporaryImageCallback,
+ chrome.test.fail);
}
function temporaryImageCallback(entry) {
testImageFileEntry = entry;
- entry.createWriter(
- chrome.test.callbackPass(imageWriterCallback),
- chrome.test.fail);
+ entry.createWriter(imageWriterCallback, chrome.test.fail);
}
function imageWriterCallback(writer) {
@@ -79,8 +82,8 @@ function runTest(testCase, getOnwriteendCallback) {
chrome.test.fail("Unable to write test image: " + e.toString());
}
- writer.onwriteend = chrome.test.callbackPass(
- getOnwriteendCallback(testImageFileEntry, galleries));
+ writer.onwriteend = getOnwriteendCallback(testImageFileEntry, galleries,
+ testCase.filename);
writer.write(blob);
}
@@ -93,3 +96,19 @@ function createTest(testCase, getOnwriteendCallback) {
runTest(testCase, getOnwriteendCallback);
};
}
+
+// Create a dummy window to prevent the ExtensionProcessManager from suspending
+// the chrome-test app. Needed because the writer.onerror and writer.onwriteend
+// events do not qualify as pending callbacks, so the app looks dormant.
+chrome.app.runtime.onLaunched.addListener(function() {
+ chrome.app.window.create('dummy.html', {
+ bounds: {
+ width: 800,
+ height: 600,
+ left: 100,
+ top: 100
+ },
+ minWidth: 800,
+ minHeight: 600
+ });
+});
« no previous file with comments | « chrome/browser/extensions/api/media_galleries/media_galleries_apitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698