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

Unified Diff: third_party/WebKit/Source/web/tests/TextFinderTest.cpp

Issue 1550563002: Blink Platform: Remove time functions from Platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/web/tests/TextFinderTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
index dc79c9f70374412e547454a6092adb04a728f5a3..a6a43d4667a7a311e8711f88da50620df075fc89 100644
--- a/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
+++ b/third_party/WebKit/Source/web/tests/TextFinderTest.cpp
@@ -396,43 +396,30 @@ TEST_F(TextFinderTest, SequentialMatches)
class TextFinderFakeTimerTest : public TextFinderTest {
protected:
- // A simple platform that mocks out the clock.
- class TimeProxyPlatform : public TestingPlatformSupport {
- public:
- TimeProxyPlatform()
- : m_timeCounter(m_oldPlatform->currentTimeSeconds())
- {
- }
-
- private:
- Platform& ensureFallback()
- {
- ASSERT(m_oldPlatform);
- return *m_oldPlatform;
- }
-
- // From blink::Platform:
- double currentTimeSeconds() override
- {
- return ++m_timeCounter;
- }
-
- // These two methods allow timers to work correctly.
- double monotonicallyIncreasingTimeSeconds() override
- {
- return ensureFallback().monotonicallyIncreasingTimeSeconds();
- }
-
- WebUnitTestSupport* unitTestSupport() override { return ensureFallback().unitTestSupport(); }
- WebString defaultLocale() override { return ensureFallback().defaultLocale(); }
- WebCompositorSupport* compositorSupport() override { return ensureFallback().compositorSupport(); }
-
- double m_timeCounter;
- };
-
- TimeProxyPlatform m_proxyTimePlatform;
+ void SetUp() override
+ {
+ s_timeElapsed = 0.0;
+ m_originalTimeFunction = setTimeFunctionsForTesting(returnMockTime);
+ }
+
+ void TearDown() override
+ {
+ setTimeFunctionsForTesting(m_originalTimeFunction);
+ }
+
+private:
+ static double returnMockTime()
+ {
+ s_timeElapsed += 1.0;
+ return s_timeElapsed;
+ }
+
+ TimeFunction m_originalTimeFunction;
+ static double s_timeElapsed;
};
+double TextFinderFakeTimerTest::s_timeElapsed;
+
TEST_F(TextFinderFakeTimerTest, ScopeWithTimeouts)
{
// Make a long string.

Powered by Google App Engine
This is Rietveld 408576698