Commit fe24d671 authored by Rune Lillesveen's avatar Rune Lillesveen Committed by Commit Bot

Use scope helpers for runtime features in platform tests.

A more robust way of making sure the features are set back to its
original state for other tests.

Change-Id: I4187c7eba820006736c8f49bc8ac85aaa359dc58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1632189Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663818}
parent 0cfd4dba
......@@ -5,7 +5,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/heap/heap_test_utilities.h"
#include "third_party/blink/renderer/platform/heap/thread_state_scopes.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
namespace blink {
......@@ -18,7 +18,6 @@ class ThreadStateSchedulingTest : public testing::Test {
}
void TearDown() override {
features_backup_.Restore();
PreciselyCollectGarbage();
EXPECT_EQ(ThreadState::kNoGCScheduled, state_->GetGCState());
EXPECT_FALSE(state_->IsMarkingInProgress());
......@@ -26,7 +25,6 @@ class ThreadStateSchedulingTest : public testing::Test {
}
void StartIncrementalMarking() {
RuntimeEnabledFeatures::SetHeapIncrementalMarkingEnabled(true);
EXPECT_EQ(ThreadState::kNoGCScheduled, state_->GetGCState());
state_->ScheduleIncrementalGC(BlinkGC::GCReason::kForcedGCForTesting);
state_->RunScheduledGC(BlinkGC::kNoHeapPointersOnStack);
......@@ -56,7 +54,6 @@ class ThreadStateSchedulingTest : public testing::Test {
private:
ThreadState* state_;
int initial_gc_age_;
RuntimeEnabledFeatures::Backup features_backup_;
};
TEST_F(ThreadStateSchedulingTest, ScheduleIncrementalV8FollowupGCAgain) {
......@@ -104,6 +101,7 @@ TEST_F(ThreadStateSchedulingTest,
TEST_F(ThreadStateSchedulingTest, SchedulePreciseGCWhileIncrementalMarking) {
ThreadStateSchedulingTest* test = this;
ScopedHeapIncrementalMarkingForTest scoped_feature(true);
test->StartIncrementalMarking();
test->state()->SchedulePreciseGC();
// Scheduling a precise GC should cancel incremental marking tasks.
......@@ -124,6 +122,7 @@ TEST_F(ThreadStateSchedulingTest, SchedulePreciseGCWhileIncrementalMarking) {
TEST_F(ThreadStateSchedulingTest,
ScheduleIncrementalV8FollowupGCWhileIncrementalMarking) {
ThreadStateSchedulingTest* test = this;
ScopedHeapIncrementalMarkingForTest scoped_feature(true);
test->StartIncrementalMarking();
test->state()->ScheduleIncrementalGC(
BlinkGC::GCReason::kIncrementalV8FollowupGC);
......
......@@ -30,7 +30,7 @@
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/lifecycle_notifier.h"
#include "third_party/blink/renderer/platform/lifecycle_observer.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
namespace blink {
......@@ -140,8 +140,7 @@ TEST(LifecycleContextTest, ObserverRemovedDuringNotifyDestroyed) {
// This is a regression test for http://crbug.com/854639.
TEST(LifecycleContextTest, ShouldNotHitCFICheckOnIncrementalMarking) {
bool was_enabled = RuntimeEnabledFeatures::HeapIncrementalMarkingEnabled();
RuntimeEnabledFeatures::SetHeapIncrementalMarkingEnabled(true);
ScopedHeapIncrementalMarkingForTest scoped_feature(true);
ThreadState* thread_state = ThreadState::Current();
thread_state->IncrementalMarkingStart(BlinkGC::GCReason::kForcedGCForTesting);
......@@ -160,8 +159,6 @@ TEST(LifecycleContextTest, ShouldNotHitCFICheckOnIncrementalMarking) {
ThreadState::kIncrementalMarkingStepScheduled)
thread_state->IncrementalMarkingStep(BlinkGC::kNoHeapPointersOnStack);
thread_state->IncrementalMarkingFinalize();
RuntimeEnabledFeatures::SetHeapIncrementalMarkingEnabled(was_enabled);
}
TEST(LifecycleContextTest, ForEachObserver) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment