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

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 7528003: CrOS - Fix flaky FileManagerDialogTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename message to worker-initialized Created 9 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 | « no previous file | chrome/browser/resources/file_manager/js/main.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/file_manager/js/file_manager.js
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index bc755bafa2ef3bb80fa6367d9bf6c1365b625851..f3f490c84969ee016d510aee70dce34fd0bf2908 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -148,6 +148,8 @@ function FileManager(dialogDom, filesystem, rootEntries, params) {
this.metadataReader_ = new Worker('js/metadata_dispatcher.js');
this.metadataReader_.onmessage = this.onMetadataMessage_.bind(this);
this.metadataReader_.postMessage({verb: 'init'});
+ // Initialization is not complete until the Worker sends back the
+ // 'initialized' message. See below.
}
FileManager.prototype = {
@@ -1499,8 +1501,17 @@ FileManager.prototype = {
this.onMetadataResult_(fileURL, {});
};
- FileManager.prototype.onMetadataFilter_ = function(regexp) {
+ /**
+ * Handles the 'initialized' message from the metadata reader Worker.
+ */
+ FileManager.prototype.onMetadataInitialized_ = function(regexp) {
this.metadataUrlFilter_ = regexp;
+ // We're ready to run. Tests can monitor for this state with
+ // ExtensionTestMessageListener listener("worker-initialized");
+ // ASSERT_TRUE(listener.WaitUntilSatisfied());
+ // Automated tests need to wait for this, otherwise we crash in browser_test
+ // cleanup because the worker process still has URL requests in-flight.
+ chrome.test.sendMessage('worker-initialized');
};
FileManager.prototype.onMetadataLog_ = function(arglist) {
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/js/main.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698