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

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

Issue 1373833003: Make WTF::Vector work with gmock matchers, refactor some tests to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed a couple Created 5 years, 2 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/core/dom/ScriptRunnerTest.cpp ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9a0900c88513271e3bdb625de9f0e0e5d18a3644..91b62dc0532fbe3bc2e12e02736b04d25862f5a3 100644
--- a/third_party/WebKit/Source/platform/TimerTest.cpp
+++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -135,7 +135,7 @@ public:
void runUntilIdle()
{
- while (!m_timerTasks.empty()) {
+ while (m_timerTasks.size()) {
gCurrentTimeSecs = m_timerTasks.top().runTimeSeconds();
m_timerTasks.top().run();
m_timerTasks.pop();
@@ -144,7 +144,7 @@ public:
void runUntilIdleOrDeadlinePassed(double deadline)
{
- while (!m_timerTasks.empty()) {
+ while (m_timerTasks.size()) {
if (m_timerTasks.top().runTimeSeconds() > deadline) {
gCurrentTimeSecs = deadline;
break;
@@ -157,7 +157,7 @@ public:
void runPendingTasks()
{
- while (!m_timerTasks.empty() && m_timerTasks.top().runTimeSeconds() <= gCurrentTimeSecs) {
+ while (m_timerTasks.size() && m_timerTasks.top().runTimeSeconds() <= gCurrentTimeSecs) {
m_timerTasks.top().run();
m_timerTasks.pop();
}
@@ -298,12 +298,12 @@ public:
void countingTask(Timer<TimerTest>*)
{
- m_runTimes.push_back(monotonicallyIncreasingTime());
+ m_runTimes.append(monotonicallyIncreasingTime());
}
void recordNextFireTimeTask(Timer<TimerTest>* timer)
{
- m_nextFireTimes.push_back(monotonicallyIncreasingTime() + timer->nextFireInterval());
+ m_nextFireTimes.append(monotonicallyIncreasingTime() + timer->nextFireInterval());
}
void advanceTimeBy(double timeSecs)
@@ -338,9 +338,8 @@ public:
protected:
double m_startTime;
- // TODO(alexclarke): Migrate to WTF::Vector and add gmock matcher support.
- std::vector<double> m_runTimes;
- std::vector<double> m_nextFireTimes;
+ WTF::Vector<double> m_runTimes;
+ WTF::Vector<double> m_nextFireTimes;
private:
OwnPtr<TimerTestPlatform> m_platform;
@@ -370,7 +369,7 @@ TEST_F(TimerTest, StartOneShot_ZeroAndCancel)
timer.stop();
runUntilIdle();
- EXPECT_TRUE(m_runTimes.empty());
+ EXPECT_FALSE(m_runTimes.size());
}
TEST_F(TimerTest, StartOneShot_ZeroAndCancelThenRepost)
@@ -384,7 +383,7 @@ TEST_F(TimerTest, StartOneShot_ZeroAndCancelThenRepost)
timer.stop();
runUntilIdle();
- EXPECT_TRUE(m_runTimes.empty());
+ EXPECT_FALSE(m_runTimes.size());
timer.startOneShot(0, FROM_HERE);
@@ -438,7 +437,7 @@ TEST_F(TimerTest, StartOneShot_NonZeroAndCancel)
timer.stop();
runUntilIdle();
- EXPECT_TRUE(m_runTimes.empty());
+ EXPECT_FALSE(m_runTimes.size());
}
TEST_F(TimerTest, StartOneShot_NonZeroAndCancelThenRepost)
@@ -452,7 +451,7 @@ TEST_F(TimerTest, StartOneShot_NonZeroAndCancelThenRepost)
timer.stop();
runUntilIdle();
- EXPECT_TRUE(m_runTimes.empty());
+ EXPECT_FALSE(m_runTimes.size());
double secondPostTime = monotonicallyIncreasingTime();
timer.startOneShot(10, FROM_HERE);
« no previous file with comments | « third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp ('k') | third_party/WebKit/Source/wtf/Vector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698