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

Use helpers to restore DisplayLocking flags in tests.

Change-Id: I199db5d33a571a07e5bc9cc41ea4ac29a3295890
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1637560Reviewed-by: default avatarvmpstr <vmpstr@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#665546}
parent b3c5c9a5
......@@ -18,22 +18,15 @@
namespace blink {
class DisplayLockBudgetTest : public RenderingTest {
class DisplayLockBudgetTest : public RenderingTest,
private ScopedDisplayLockingForTest {
public:
DisplayLockBudgetTest() : ScopedDisplayLockingForTest(true) {}
void SetUp() override {
RenderingTest::SetUp();
features_backup_.emplace();
RuntimeEnabledFeatures::SetDisplayLockingEnabled(true);
test_task_runner_ = base::MakeRefCounted<base::TestMockTimeTaskRunner>();
}
void TearDown() override {
if (features_backup_) {
features_backup_->Restore();
features_backup_.reset();
}
}
double GetBudgetMs(const YieldingDisplayLockBudget& budget) const {
return budget.GetCurrentBudgetMs();
}
......
......@@ -17,7 +17,7 @@
#include "third_party/blink/renderer/core/html/html_template_element.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h"
namespace blink {
......@@ -84,19 +84,16 @@ class DisplayLockEmptyEventListener final : public NativeEventListener {
};
} // namespace
class DisplayLockContextTest : public testing::Test {
class DisplayLockContextTest : public testing::Test,
private ScopedDisplayLockingForTest {
public:
DisplayLockContextTest() : ScopedDisplayLockingForTest(true) {}
void SetUp() override {
features_backup_.emplace();
RuntimeEnabledFeatures::SetDisplayLockingEnabled(true);
web_view_helper_.Initialize();
}
void TearDown() override {
if (features_backup_) {
features_backup_->Restore();
features_backup_.reset();
}
web_view_helper_.Reset();
}
......@@ -163,7 +160,6 @@ class DisplayLockContextTest : public testing::Test {
const int FAKE_FIND_ID = 1;
private:
base::Optional<RuntimeEnabledFeatures::Backup> features_backup_;
frame_test_helpers::WebViewHelper web_view_helper_;
};
......
......@@ -10,23 +10,16 @@
#include "third_party/blink/renderer/core/dom/shadow_root.h"
#include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
#include "third_party/blink/renderer/core/testing/page_test_base.h"
#include "third_party/blink/renderer/platform/testing/runtime_enabled_features_test_helpers.h"
namespace blink {
class DisplayLockUtilitiesTest : public RenderingTest {
class DisplayLockUtilitiesTest : public RenderingTest,
private ScopedDisplayLockingForTest {
public:
DisplayLockUtilitiesTest()
: RenderingTest(MakeGarbageCollected<SingleChildLocalFrameClient>()) {}
void SetUp() override {
RenderingTest::SetUp();
RuntimeEnabledFeatures::SetDisplayLockingEnabled(true);
}
void TearDown() override {
RenderingTest::TearDown();
RuntimeEnabledFeatures::SetDisplayLockingEnabled(false);
}
: RenderingTest(MakeGarbageCollected<SingleChildLocalFrameClient>()),
ScopedDisplayLockingForTest(true) {}
};
TEST_F(DisplayLockUtilitiesTest, ActivatableLockedInclusiveAncestors) {
......
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