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

Unified Diff: third_party/WebKit/Source/platform/TimerTest.cpp

Issue 1466603003: Revert of More regular Platform implementations in unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/platform/TimerTest.cpp
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp
index 4585d950a9ea94398c99ca95a6626896b7939ae3..0b14918ebfa79b58511a0fb9aa1bcda868b08d47 100644
--- a/third_party/WebKit/Source/platform/TimerTest.cpp
+++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -5,7 +5,6 @@
#include "config.h"
#include "platform/Timer.h"
-#include "platform/testing/TestingPlatformSupport.h"
#include "public/platform/Platform.h"
#include "public/platform/WebScheduler.h"
#include "public/platform/WebThread.h"
@@ -237,7 +236,7 @@
OwnPtr<MockWebScheduler> m_webScheduler;
};
-class TimerTestPlatform : public TestingPlatformSupport {
+class TimerTestPlatform : public Platform {
public:
TimerTestPlatform()
: m_webThread(adoptPtr(new FakeWebThread())) { }
@@ -248,6 +247,17 @@
return m_webThread.get();
}
+ void cryptographicallyRandomValues(unsigned char*, size_t) override
+ {
+ ASSERT_NOT_REACHED();
+ }
+
+ const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) override
+ {
+ static const unsigned char enabled[] = {0};
+ return enabled;
+ }
+
void runUntilIdle()
{
mockScheduler()->runUntilIdle();
@@ -286,6 +296,9 @@
public:
void SetUp() override
{
+ m_platform = adoptPtr(new TimerTestPlatform());
+ m_oldPlatform = Platform::current();
+ Platform::initialize(m_platform.get());
WTF::setMonotonicallyIncreasingTimeFunction(currentTime);
m_runTimes.clear();
@@ -293,6 +306,11 @@
m_startTime = gCurrentTimeSecs;
}
+ void TearDown() override
+ {
+ Platform::initialize(m_oldPlatform);
+ }
+
void countingTask(Timer<TimerTest>*)
{
m_runTimes.append(monotonicallyIncreasingTime());
@@ -310,27 +328,27 @@
void runUntilIdle()
{
- m_platform.runUntilIdle();
+ m_platform->runUntilIdle();
}
void runPendingTasks()
{
- m_platform.runPendingTasks();
+ m_platform->runPendingTasks();
}
void runUntilIdleOrDeadlinePassed(double deadline)
{
- m_platform.runUntilIdleOrDeadlinePassed(deadline);
+ m_platform->runUntilIdleOrDeadlinePassed(deadline);
}
bool hasOneTimerTask() const
{
- return m_platform.hasOneTimerTask();
+ return m_platform->hasOneTimerTask();
}
double nextTimerTaskDelaySecs() const
{
- return m_platform.nextTimerTaskDelaySecs();
+ return m_platform->nextTimerTaskDelaySecs();
}
protected:
@@ -339,7 +357,8 @@
WTF::Vector<double> m_nextFireTimes;
private:
- TimerTestPlatform m_platform;
+ OwnPtr<TimerTestPlatform> m_platform;
+ Platform* m_oldPlatform;
};
TEST_F(TimerTest, StartOneShot_Zero)
« no previous file with comments | « third_party/WebKit/Source/platform/TestingPlatformSupport.cpp ('k') | third_party/WebKit/Source/platform/blink_platform.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698