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

Unified Diff: chrome/test/data/webui/md_bookmarks/toast_manager_test.js

Issue 2926763005: [MD Bookmarks] Refactor window timer mocking. (Closed)
Patch Set: address comments Created 3 years, 6 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/test/data/webui/md_bookmarks/test_timer_proxy.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/md_bookmarks/toast_manager_test.js
diff --git a/chrome/test/data/webui/md_bookmarks/toast_manager_test.js b/chrome/test/data/webui/md_bookmarks/toast_manager_test.js
index 8830c8b2272d12876227a816998375a39abc4c9c..24ba4218c42f0e68495c6d78069f87544a425295 100644
--- a/chrome/test/data/webui/md_bookmarks/toast_manager_test.js
+++ b/chrome/test/data/webui/md_bookmarks/toast_manager_test.js
@@ -25,35 +25,28 @@ suite('<bookmarks-toast-manager>', function() {
});
test('auto hide', function() {
- toastManager.duration = 100;
+ var timerProxy = new bookmarks.TestTimerProxy();
+ timerProxy.immediatelyResolveTimeouts = false;
+ toastManager.timerProxy_ = timerProxy;
- var timeoutFunc = null;
- var timeoutCounter = 0;
- var clearedTimeout = null;
- toastManager.setTimeout_ = function(f) {
- timeoutFunc = f;
- return timeoutCounter++;
- };
- toastManager.clearTimeout_ = function(n) {
- clearedTimeout = n;
- };
+ toastManager.duration = 100;
toastManager.show('test', false);
- assertEquals(0, toastManager.hideTimeout_);
+ assertEquals(0, toastManager.hideTimeoutId_);
assertTrue(toastManager.open_);
- timeoutFunc();
- assertEquals(null, toastManager.hideTimeout_);
+ timerProxy.runTimeoutFn(0);
+ assertEquals(null, toastManager.hideTimeoutId_);
assertFalse(toastManager.open_);
// Check that multiple shows reset the timeout.
toastManager.show('test', false);
- assertEquals(1, toastManager.hideTimeout_);
+ assertEquals(1, toastManager.hideTimeoutId_);
assertTrue(toastManager.open_);
toastManager.show('test2', false);
- assertEquals(1, clearedTimeout);
- assertEquals(2, toastManager.hideTimeout_);
+ assertFalse(timerProxy.hasTimeout(1));
+ assertEquals(2, toastManager.hideTimeoutId_);
assertTrue(toastManager.open_);
});
});
« no previous file with comments | « chrome/test/data/webui/md_bookmarks/test_timer_proxy.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698