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

Unified Diff: chrome/common/page_load_metrics/test/weak_mock_timer.h

Issue 2901383002: Buffer cross frame paint timing updates. (Closed)
Patch Set: factor WeakMockTimer into a common location. Created 3 years, 7 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/common/page_load_metrics/test/weak_mock_timer.h
diff --git a/chrome/common/page_load_metrics/test/weak_mock_timer.h b/chrome/common/page_load_metrics/test/weak_mock_timer.h
new file mode 100644
index 0000000000000000000000000000000000000000..c364a882c640f5eccea1a4242bb9e19463c335da
--- /dev/null
+++ b/chrome/common/page_load_metrics/test/weak_mock_timer.h
@@ -0,0 +1,36 @@
+// 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.
+
+#ifndef CHROME_COMMON_PAGE_LOAD_METRICS_TEST_WEAK_MOCK_TIMER_H_
+#define CHROME_COMMON_PAGE_LOAD_METRICS_TEST_WEAK_MOCK_TIMER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/timer/mock_timer.h"
+
+namespace page_load_metrics {
Charlie Harrison 2017/05/30 14:49:08 We didn't talk about this before but it is also no
Bryan McQuade 2017/05/30 15:30:23 Ah, I grepped around until chrome/common and didn'
+
+// WeakMockTimer is a MockTimer that allows clients to keep WeakPtr<>s to it.
+class WeakMockTimer : public base::MockTimer,
+ public base::SupportsWeakPtr<WeakMockTimer> {
+ public:
+ WeakMockTimer();
+};
Charlie Harrison 2017/05/30 14:49:08 Do we want to DISALLOW_COPY_AND_ASSIGN to these ti
Bryan McQuade 2017/05/30 15:30:23 done
+
+// WeakMockTimerProvider is a testing helper class that test classes can inherit
+// from to provide basic MockTimer tracking capabilities.
+class WeakMockTimerProvider {
+ public:
+ WeakMockTimerProvider();
+ virtual ~WeakMockTimerProvider();
+
+ base::MockTimer* GetMockTimer() const;
+ void SetMockTimer(base::WeakPtr<WeakMockTimer> timer);
+
+ private:
+ base::WeakPtr<WeakMockTimer> timer_;
+};
+
+} // namespace page_load_metrics
+
+#endif // CHROME_COMMON_PAGE_LOAD_METRICS_TEST_WEAK_MOCK_TIMER_H_

Powered by Google App Engine
This is Rietveld 408576698