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

Unified Diff: cc/output/output_surface_unittest.cc

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: fix some tests; needs rebase; Created 7 years, 6 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
Index: cc/output/output_surface_unittest.cc
diff --git a/cc/output/output_surface_unittest.cc b/cc/output/output_surface_unittest.cc
index a73b7790cf30f897286efdc05bfc35680a85b836..beb6a0046866ac49854a4ef3d66240cd1d106c9c 100644
--- a/cc/output/output_surface_unittest.cc
+++ b/cc/output/output_surface_unittest.cc
@@ -17,15 +17,18 @@ namespace {
class TestOutputSurface : public OutputSurface {
public:
explicit TestOutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d)
- : OutputSurface(context3d.Pass()) {}
+ : OutputSurface(context3d.Pass()),
+ retroactive_begin_frame_deadline_enabled_(false) {}
explicit TestOutputSurface(
scoped_ptr<cc::SoftwareOutputDevice> software_device)
- : OutputSurface(software_device.Pass()) {}
+ : OutputSurface(software_device.Pass()),
+ retroactive_begin_frame_deadline_enabled_(false) {}
TestOutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d,
scoped_ptr<cc::SoftwareOutputDevice> software_device)
- : OutputSurface(context3d.Pass(), software_device.Pass()) {}
+ : OutputSurface(context3d.Pass(), software_device.Pass()),
+ retroactive_begin_frame_deadline_enabled_(false) {}
bool InitializeNewContext3D(
scoped_ptr<WebKit::WebGraphicsContext3D> new_context3d) {
@@ -58,8 +61,8 @@ class TestOutputSurface : public OutputSurface {
OnSwapBuffersComplete(NULL);
}
- void SetRetroactiveBeginFramePeriod(base::TimeDelta period) {
- retroactive_begin_frame_period_ = period;
+ void EnableRetroactiveBeginFrameDeadline(bool enable) {
+ retroactive_begin_frame_deadline_enabled_ = enable;
}
protected:
@@ -68,11 +71,13 @@ class TestOutputSurface : public OutputSurface {
CheckForRetroactiveBeginFrame();
}
- virtual base::TimeDelta RetroactiveBeginFramePeriod() OVERRIDE {
- return retroactive_begin_frame_period_;
+ virtual base::TimeTicks RetroactiveBeginFrameDeadline() OVERRIDE {
+ if (retroactive_begin_frame_deadline_enabled_)
+ return OutputSurface::RetroactiveBeginFrameDeadline();
+ return base::TimeTicks();
}
- base::TimeDelta retroactive_begin_frame_period_;
+ bool retroactive_begin_frame_deadline_enabled_;
};
class FakeOutputSurfaceClient : public OutputSurfaceClient {
@@ -237,8 +242,7 @@ TEST(OutputSurfaceTest, BeginFrameEmulation) {
display_refresh_interval);
output_surface.SetMaxFramesPending(2);
- output_surface.SetRetroactiveBeginFramePeriod(
- base::TimeDelta::FromSeconds(-1));
+ output_surface.EnableRetroactiveBeginFrameDeadline(false);
// We should start off with 0 BeginFrames
EXPECT_EQ(client.begin_frame_count(), 0);
@@ -312,10 +316,7 @@ TEST(OutputSurfaceTest, OptimisticAndRetroactiveBeginFrames) {
EXPECT_FALSE(client.deferred_initialize_called());
output_surface.SetMaxFramesPending(2);
-
- // Enable retroactive BeginFrames.
- output_surface.SetRetroactiveBeginFramePeriod(
- base::TimeDelta::FromSeconds(100000));
+ output_surface.EnableRetroactiveBeginFrameDeadline(true);
// Optimistically injected BeginFrames should be throttled if
// SetNeedsBeginFrame is false...

Powered by Google App Engine
This is Rietveld 408576698