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

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

Issue 2901383002: Buffer cross frame paint timing updates. (Closed)
Patch Set: address comment 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..185b586530b6d484ccfe0969b28fb593f14c44c1
--- /dev/null
+++ b/chrome/common/page_load_metrics/test/weak_mock_timer.h
@@ -0,0 +1,44 @@
+// 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/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "base/timer/mock_timer.h"
+
+namespace page_load_metrics {
+namespace test {
+
+// WeakMockTimer is a MockTimer that allows clients to keep WeakPtr<>s to it.
+class WeakMockTimer : public base::MockTimer,
+ public base::SupportsWeakPtr<WeakMockTimer> {
+ public:
+ WeakMockTimer();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(WeakMockTimer);
+};
+
+// 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_;
+
+ DISALLOW_COPY_AND_ASSIGN(WeakMockTimerProvider);
+};
+
+} // namespace test
+} // namespace page_load_metrics
+
+#endif // CHROME_COMMON_PAGE_LOAD_METRICS_TEST_WEAK_MOCK_TIMER_H_

Powered by Google App Engine
This is Rietveld 408576698