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

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: Merrrge agaaain. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/web/WebKit.cpp ('k') | third_party/WebKit/Source/wtf/CurrentTime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a3ec1cc8e5f6b46a19b817f03fc69bc4980e458e..e3e716d68154a17c953a6a5ddf46ceba47c8ca96 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.
« no previous file with comments | « third_party/WebKit/Source/web/WebKit.cpp ('k') | third_party/WebKit/Source/wtf/CurrentTime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698