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

Unified Diff: ui/file_manager/file_manager/foreground/js/preview_panel_model_unittest.js

Issue 871563002: Generalize PreviewPanelModel so that it stops to refer specific cloud-import CSS class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 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: ui/file_manager/file_manager/foreground/js/preview_panel_model_unittest.js
diff --git a/ui/file_manager/file_manager/foreground/js/preview_panel_model_unittest.js b/ui/file_manager/file_manager/foreground/js/preview_panel_model_unittest.js
index a5cf4ab169f49bf5c2c000b3ee9a2abc6d04e76b..6651414eff50ec64158b086f3030690efbb98ff2 100644
--- a/ui/file_manager/file_manager/foreground/js/preview_panel_model_unittest.js
+++ b/ui/file_manager/file_manager/foreground/js/preview_panel_model_unittest.js
@@ -2,24 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-/**
- * Timeout in milliseconds to determine if the event is dispatched or not.
- * If the event is dispached in the timeout, the test regards the event is
- * dispatched, otherwise not. Otherwise it regards the event is not dispatched.
- */
-var TIMEOUT_MS = 3000;
-
function testPreviewPanelModel(callback) {
document.querySelector('body').innerHTML =
- '<command class="cloud-import" hidden></command>';
- var command = document.querySelector('command.cloud-import');
+ '<command class="auto-visibility" hidden></command>';
+ var command = document.querySelector('command.auto-visibility');
var model = new PreviewPanelModel(PreviewPanelModel.VisibilityType.AUTO);
var testStep = function(step, changed) {
var waitPromise = new Promise(function(fulfill) {
model.addEventListener(
PreviewPanelModel.EventType.CHANGE, fulfill.bind(null, true));
- setTimeout(fulfill.bind(null, false), TIMEOUT_MS);
+ // The handler of hiddenChange event in PreviewPanelModel dispatches
+ // PreviewPanelModel.EventType.CHANGE event synchronously. Thus if
+ // the below hiddenChange handler is called ahead of the above change
+ // handler, it means PreviewPanelModel.EventType.CHANGE was not
+ // dispatched.
+ command.addEventListener('hiddenChange', fulfill.bind(null, false));
});
switch (step) {
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/preview_panel_model.js ('k') | ui/file_manager/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698