diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-21 10:57:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-21 10:57:44 +0200 |
commit | 5ef7c8a6a70875d4430752d146bdcb069605d71d (patch) | |
tree | f6256640b6c46d7da221435803cae65326817ba2 /Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp | |
parent | decad929f578d8db641febc8740649ca6c574638 (diff) | |
download | qtwebkit-5ef7c8a6a70875d4430752d146bdcb069605d71d.tar.gz |
Imported WebKit commit 356d83016b090995d08ad568f2d2c243aa55e831 (http://svn.webkit.org/repository/webkit/trunk@126147)
New snapshot including various build fixes for newer Qt 5
Diffstat (limited to 'Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp')
-rw-r--r-- | Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp b/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp index 20f2374a3..3cf646a74 100644 --- a/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp +++ b/Source/WebKit/chromium/tests/CCFrameRateControllerTest.cpp @@ -24,7 +24,7 @@ #include "config.h" -#include "cc/CCFrameRateController.h" +#include "CCFrameRateController.h" #include "CCSchedulerTestCommon.h" #include <gtest/gtest.h> @@ -63,7 +63,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) // Trigger one frame, make sure the vsync callback is called elapsed += thread.pendingDelayMs() / 1000.0; - timeSource->setMonotonicallyIncreasingTime(elapsed); + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); client.reset(); @@ -72,13 +72,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_ImmediateAck) controller.didBeginFrame(); // Tell the controller the frame ended 5ms later - timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005); + timeSource->setMonotonicTimeNow(timeSource->monotonicTimeNow() + 0.005); controller.didFinishFrame(); // Trigger another frame, make sure vsync runs again elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); } @@ -98,7 +98,7 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger one frame, make sure the vsync callback is called elapsed += thread.pendingDelayMs() / 1000.0; - timeSource->setMonotonicallyIncreasingTime(elapsed); + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); client.reset(); @@ -108,8 +108,8 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger another frame, make sure vsync callback runs again elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); client.reset(); @@ -119,13 +119,13 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger another frame. Since two frames are pending, we should not draw. elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_FALSE(client.vsyncTicked()); // Tell the controller the first frame ended 5ms later - timeSource->setMonotonicallyIncreasingTime(timeSource->monotonicallyIncreasingTime() + 0.005); + timeSource->setMonotonicTimeNow(timeSource->monotonicTimeNow() + 0.005); controller.didFinishFrame(); // Tick should not have been called @@ -133,8 +133,8 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_TwoFramesInFlight) // Trigger yet another frame. Since one frames is pending, another vsync callback should run. elapsed += thread.pendingDelayMs() / 1000.0; - EXPECT_TRUE(elapsed >= timeSource->monotonicallyIncreasingTime()); // Sanity check that previous code didn't move time backward. - timeSource->setMonotonicallyIncreasingTime(elapsed); + EXPECT_TRUE(elapsed >= timeSource->monotonicTimeNow()); // Sanity check that previous code didn't move time backward. + timeSource->setMonotonicTimeNow(elapsed); thread.runPendingTask(); EXPECT_TRUE(client.vsyncTicked()); } @@ -154,6 +154,17 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_Unthrottled) EXPECT_TRUE(client.vsyncTicked()); client.reset(); + // Even if we don't call didBeginFrame, CCFrameRateController should + // still attempt to vsync tick multiple times until it does result in + // a didBeginFrame. + thread.runPendingTask(); + EXPECT_TRUE(client.vsyncTicked()); + client.reset(); + + thread.runPendingTask(); + EXPECT_TRUE(client.vsyncTicked()); + client.reset(); + // didBeginFrame triggers 2nd frame, make sure the vsync callback is called controller.didBeginFrame(); thread.runPendingTask(); @@ -166,6 +177,9 @@ TEST(CCFrameRateControllerTest, TestFrameThrottling_Unthrottled) EXPECT_FALSE(client.vsyncTicked()); client.reset(); + // Make sure there is no pending task since we can't do anything until we receive a didFinishFrame anyway. + EXPECT_FALSE(thread.hasPendingTask()); + // didFinishFrame triggers a frame, make sure the vsync callback is called controller.didFinishFrame(); thread.runPendingTask(); |