Index: ui/ozone/public/ozone_platform.h |
diff --git a/ui/ozone/public/ozone_platform.h b/ui/ozone/public/ozone_platform.h |
index 97cab2cfebd51b060fd9870d7c7b618cebb65500..d30d8e6f627dee69b05179a0a02e1cdc5c7abcd9 100644 |
--- a/ui/ozone/public/ozone_platform.h |
+++ b/ui/ozone/public/ozone_platform.h |
@@ -7,6 +7,7 @@ |
#include <memory> |
+#include "base/auto_reset.h" |
#include "base/macros.h" |
#include "base/message_loop/message_loop.h" |
#include "ui/ozone/ozone_export.h" |
@@ -126,6 +127,8 @@ class OZONE_EXPORT OzonePlatform { |
virtual void AddInterfaces(service_manager::InterfaceRegistry* registry); |
private: |
+ friend class ScopedOzonePlatformForTesting; |
+ |
virtual void InitializeUI(const InitParams& params) = 0; |
virtual void InitializeGPU(const InitParams& params) = 0; |
@@ -134,6 +137,18 @@ class OZONE_EXPORT OzonePlatform { |
DISALLOW_COPY_AND_ASSIGN(OzonePlatform); |
}; |
+// Allows the ozone platform instance to be overridden in tests. |
+class OZONE_EXPORT ScopedOzonePlatformForTesting { |
+ public: |
+ ScopedOzonePlatformForTesting(OzonePlatform* test_instance); |
+ ~ScopedOzonePlatformForTesting(); |
+ |
+ private: |
+ base::AutoReset<OzonePlatform*> auto_reset_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedOzonePlatformForTesting); |
+}; |
+ |
} // namespace ui |
#endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ |