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..018e020d141b371031181443bf37f8ccb839b356 100644 |
--- a/chrome/test/data/webui/md_bookmarks/toast_manager_test.js |
+++ b/chrome/test/data/webui/md_bookmarks/toast_manager_test.js |
@@ -25,24 +25,17 @@ 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_); |
assertTrue(toastManager.open_); |
- timeoutFunc(); |
+ timerProxy.runTimeoutFn(0); |
assertEquals(null, toastManager.hideTimeout_); |
assertFalse(toastManager.open_); |
@@ -52,7 +45,7 @@ suite('<bookmarks-toast-manager>', function() { |
assertTrue(toastManager.open_); |
toastManager.show('test2', false); |
- assertEquals(1, clearedTimeout); |
+ assertFalse(timerProxy.hasTimeout(1)); |
assertEquals(2, toastManager.hideTimeout_); |
assertTrue(toastManager.open_); |
}); |