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_); |
}); |
}); |