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

Unified Diff: chrome/browser/resources/md_bookmarks/timer_proxy.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
Index: chrome/browser/resources/md_bookmarks/timer_proxy.js
diff --git a/chrome/browser/resources/md_bookmarks/timer_proxy.js b/chrome/browser/resources/md_bookmarks/timer_proxy.js
new file mode 100644
index 0000000000000000000000000000000000000000..de96c7fdb4ec7aa2b5bfe9c2329ccaff095de13f
--- /dev/null
+++ b/chrome/browser/resources/md_bookmarks/timer_proxy.js
@@ -0,0 +1,33 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview A class that mediates window timer calls to support mockability
+ * in tests.
+ */
+
+cr.define('bookmarks', function() {
+ /** @constructor */
+ function TimerProxy() {}
+
+ TimerProxy.prototype = {
+ /**
+ * @param {Function|string} fn
+ * @param {number=} delay
+ * @return {number}
+ */
+ setTimeout: function(fn, delay) {
+ return window.setTimeout(fn, delay);
+ },
+
+ /** @param {number|undefined?} id */
+ clearTimeout: function(id) {
+ window.clearTimeout(id);
+ },
+ };
+
+ return {
+ TimerProxy: TimerProxy,
+ };
+});
« no previous file with comments | « chrome/browser/resources/md_bookmarks/timer_proxy.html ('k') | chrome/browser/resources/md_bookmarks/toast_manager.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698