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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 22926024: cc: Control activation from the Scheduler (Closed) Base URL: http://git.chromium.org/chromium/src.git@schedOutputSurface4
Patch Set: git cl format Created 7 years, 4 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 | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 73033a19b4866e75645d5cf21735c3bcd0ab92b8..3993ee2fcb8b1a6e82d80bc98d7602c85a837af2 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -701,7 +701,8 @@ MULTI_THREAD_TEST_F(LayerTreeHostTestCommit);
class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
: public LayerTreeHostTest {
public:
- LayerTreeHostTestFrameTimeUpdatesAfterActivationFails() : frame_(0) {}
+ LayerTreeHostTestFrameTimeUpdatesAfterActivationFails()
+ : frame_count_with_pending_tree_(0) {}
virtual void BeginTest() OVERRIDE {
layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
@@ -710,9 +711,18 @@ class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
PostSetNeedsCommitToMainThread();
}
+ virtual void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
+ const BeginFrameArgs& args) OVERRIDE {
+ if (host_impl->pending_tree())
+ frame_count_with_pending_tree_++;
+ host_impl->BlockNotifyReadyToActivateForTesting(
+ frame_count_with_pending_tree_ <= 1);
+ }
+
virtual void DrawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE {
- if (frame_ >= 1) {
- EXPECT_NE(first_frame_time_, impl->CurrentFrameTimeTicks());
+ if (frame_count_with_pending_tree_ > 1) {
+ EXPECT_NE(first_frame_time_.ToInternalValue(),
+ impl->CurrentFrameTimeTicks().ToInternalValue());
EndTest();
return;
}
@@ -720,35 +730,15 @@ class LayerTreeHostTestFrameTimeUpdatesAfterActivationFails
EXPECT_FALSE(impl->settings().impl_side_painting);
EndTest();
}
-
- virtual bool CanActivatePendingTree(LayerTreeHostImpl* impl) OVERRIDE {
- if (frame_ >= 1)
- return true;
-
- return false;
- }
-
- virtual bool CanActivatePendingTreeIfNeeded(LayerTreeHostImpl* impl)
- OVERRIDE {
- frame_++;
- if (frame_ == 1) {
- first_frame_time_ = impl->CurrentFrameTimeTicks();
-
- // Since base::TimeTicks::Now() uses a low-resolution clock on
- // Windows, we need to make sure that the clock has incremented past
- // first_frame_time_.
- while (first_frame_time_ == base::TimeTicks::Now()) {}
-
- return false;
- }
-
- return true;
+ virtual void DidActivateTreeOnThread(LayerTreeHostImpl* impl) OVERRIDE {
+ if (impl->settings().impl_side_painting)
+ EXPECT_NE(frame_count_with_pending_tree_, 1);
}
virtual void AfterTest() OVERRIDE {}
private:
- int frame_;
+ int frame_count_with_pending_tree_;
base::TimeTicks first_frame_time_;
};
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_scroll.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698