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

Unified Diff: third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h

Issue 2258523006: Convert Settings::rootLayerScrolls to RuntimeEnabledFeatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add RAII-style helper to toggle REF. Rebase. Created 4 years, 4 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: third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h
diff --git a/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h b/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h
new file mode 100644
index 0000000000000000000000000000000000000000..4854ba9d2e2420457cc82e1b6c2464e0553e5c95
--- /dev/null
+++ b/third_party/WebKit/Source/platform/testing/RuntimeEnabledFeaturesTestHelpers.h
@@ -0,0 +1,40 @@
+// Copyright 2016 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 RuntimeEnabledFeaturesTestHelpers_h
+#define RuntimeEnabledFeaturesTestHelpers_h
+
+#include "platform/RuntimeEnabledFeatures.h"
+#include "wtf/Assertions.h"
+
+namespace blink {
+
+template <bool(&getter)(), void(&setter)(bool)>
+class ScopedRuntimeEnabledFeatureForTest {
+public:
+ ScopedRuntimeEnabledFeatureForTest(bool enabled)
+ : m_enabled(enabled)
+ , m_original(getter())
+ {
+ setter(enabled);
+ }
+
+ ~ScopedRuntimeEnabledFeatureForTest()
+ {
+ CHECK_EQ(m_enabled, getter());
+ setter(m_original);
+ }
+
+private:
+ bool m_enabled;
+ bool m_original;
+};
+
+typedef ScopedRuntimeEnabledFeatureForTest<RuntimeEnabledFeatures::compositorWorkerEnabled, RuntimeEnabledFeatures::setCompositorWorkerEnabled> ScopedCompositorWorkerForTest;
+typedef ScopedRuntimeEnabledFeatureForTest<RuntimeEnabledFeatures::rootLayerScrollingEnabled, RuntimeEnabledFeatures::setRootLayerScrollingEnabled> ScopedRootLayerScrollingForTest;
+typedef ScopedRuntimeEnabledFeatureForTest<RuntimeEnabledFeatures::slimmingPaintV2Enabled, RuntimeEnabledFeatures::setSlimmingPaintV2Enabled> ScopedSlimmingPaintV2ForTest;
+
+} // namespace blink
+
+#endif // RuntimeEnabledFeaturesTestHelpers_h
« no previous file with comments | « third_party/WebKit/Source/platform/blink_platform.gypi ('k') | third_party/WebKit/Source/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698