Commit 2415f460 authored by Hajime Hoshi's avatar Hajime Hoshi Committed by Commit Bot

scroll: Replace the default timer task runner with one for testing

This is part of efforts to replace non-per-frame task runners with other
appropriate task runners in the renderer.

Bug: 804694
Change-Id: Ibcb96b6461fda0d777edcb961bc21294fcc5cf23
Reviewed-on: https://chromium-review.googlesource.com/897308Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Hajime Hoshi <hajimehoshi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534026}
parent cdb8cb99
...@@ -34,7 +34,10 @@ class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock { ...@@ -34,7 +34,10 @@ class ScrollbarThemeWithMockInvalidation : public ScrollbarThemeMock {
} // namespace } // namespace
using ScrollableAreaTest = ::testing::Test; class ScrollableAreaTest : public ::testing::Test {
private:
base::MessageLoop message_loop_;
};
TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) { TEST_F(ScrollableAreaTest, ScrollAnimatorCurrentPositionShouldBeSync) {
ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "platform/wtf/PtrUtil.h" #include "platform/wtf/PtrUtil.h"
#include "public/platform/Platform.h" #include "public/platform/Platform.h"
#include "public/platform/WebThread.h" #include "public/platform/WebThread.h"
#include "public/platform/scheduler/test/renderer_scheduler_test_support.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
namespace blink { namespace blink {
...@@ -96,7 +97,7 @@ class MockScrollableArea : public GarbageCollectedFinalized<MockScrollableArea>, ...@@ -96,7 +97,7 @@ class MockScrollableArea : public GarbageCollectedFinalized<MockScrollableArea>,
} }
scoped_refptr<base::SingleThreadTaskRunner> GetTimerTaskRunner() const final { scoped_refptr<base::SingleThreadTaskRunner> GetTimerTaskRunner() const final {
return Platform::Current()->CurrentThread()->Scheduler()->TimerTaskRunner(); return blink::scheduler::GetSingleThreadTaskRunnerForTesting();
} }
PlatformChromeClient* GetChromeClient() const override { PlatformChromeClient* GetChromeClient() const override {
......
...@@ -29,7 +29,10 @@ class ScrollbarThemeAuraButtonOverride final : public ScrollbarThemeAura { ...@@ -29,7 +29,10 @@ class ScrollbarThemeAuraButtonOverride final : public ScrollbarThemeAura {
} // namespace } // namespace
using ScrollbarThemeAuraTest = ::testing::Test; class ScrollbarThemeAuraTest : public ::testing::Test {
private:
base::MessageLoop message_loop_;
};
TEST_F(ScrollbarThemeAuraTest, ButtonSizeHorizontal) { TEST_F(ScrollbarThemeAuraTest, ButtonSizeHorizontal) {
ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
......
...@@ -12,7 +12,10 @@ namespace blink { ...@@ -12,7 +12,10 @@ namespace blink {
using ::testing::NiceMock; using ::testing::NiceMock;
using ::testing::Return; using ::testing::Return;
using ScrollbarThemeOverlayTest = ::testing::Test; class ScrollbarThemeOverlayTest : public ::testing::Test {
private:
base::MessageLoop message_loop_;
};
TEST_F(ScrollbarThemeOverlayTest, PaintInvalidation) { TEST_F(ScrollbarThemeOverlayTest, PaintInvalidation) {
ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler> ScopedTestingPlatformSupport<TestingPlatformSupportWithMockScheduler>
......
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