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

Side by Side 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, 3 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef RuntimeEnabledFeaturesTestHelpers_h
6 #define RuntimeEnabledFeaturesTestHelpers_h
7
8 #include "platform/RuntimeEnabledFeatures.h"
9 #include "wtf/Assertions.h"
10
11 namespace blink {
12
13 template <bool(&getter)(), void(&setter)(bool)>
14 class ScopedRuntimeEnabledFeatureForTest {
15 public:
16 ScopedRuntimeEnabledFeatureForTest(bool enabled)
17 : m_enabled(enabled)
18 , m_original(getter())
19 {
20 setter(enabled);
21 }
22
23 ~ScopedRuntimeEnabledFeatureForTest()
24 {
25 CHECK_EQ(m_enabled, getter());
26 setter(m_original);
27 }
28
29 private:
30 bool m_enabled;
31 bool m_original;
32 };
33
34 typedef ScopedRuntimeEnabledFeatureForTest<RuntimeEnabledFeatures::compositorWor kerEnabled, RuntimeEnabledFeatures::setCompositorWorkerEnabled> ScopedCompositor WorkerForTest;
35 typedef ScopedRuntimeEnabledFeatureForTest<RuntimeEnabledFeatures::rootLayerScro llingEnabled, RuntimeEnabledFeatures::setRootLayerScrollingEnabled> ScopedRootLa yerScrollingForTest;
36 typedef ScopedRuntimeEnabledFeatureForTest<RuntimeEnabledFeatures::slimmingPaint V2Enabled, RuntimeEnabledFeatures::setSlimmingPaintV2Enabled> ScopedSlimmingPain tV2ForTest;
37
38 } // namespace blink
39
40 #endif // RuntimeEnabledFeaturesTestHelpers_h
OLDNEW
« 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