Chromium Code Reviews| 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 a3c37ed627e3908fda61e47fbbaf96ee8b0425d0..6cbba72c2b7a73e4e6218fe15e24b4447de8bd6a 100644 |
| --- a/cc/trees/layer_tree_host_unittest.cc |
| +++ b/cc/trees/layer_tree_host_unittest.cc |
| @@ -6120,6 +6120,66 @@ class LayerTreeHostTestOneActivatePerPrepareTiles : public LayerTreeHostTest { |
| MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestOneActivatePerPrepareTiles); |
| +class LayerTreeHostTestFrameTimingRequestsSaveTimestamps |
| + : public LayerTreeHostTest { |
| + public: |
| + LayerTreeHostTestFrameTimingRequestsSaveTimestamps() |
| + : check_results_on_commit_(false) {} |
| + |
| + void SetupTree() override { |
| + client_.set_fill_with_nonsolid_color(true); |
|
danakj
2015/02/02 23:10:09
why?
vmpstr
2015/02/02 23:32:29
Removed.
|
| + scoped_refptr<FakePictureLayer> root_layer = |
| + FakePictureLayer::Create(&client_); |
| + root_layer->SetBounds(gfx::Size(1500, 1500)); |
| + root_layer->SetIsDrawable(true); |
| + |
| + std::vector<FrameTimingRequest> requests; |
| + requests.push_back(FrameTimingRequest(1, gfx::Rect(0, 0, 100, 100))); |
| + requests.push_back(FrameTimingRequest(2, gfx::Rect(300, 0, 100, 100))); |
| + root_layer->SetFrameTimingRequests(requests); |
| + |
| + layer_tree_host()->SetRootLayer(root_layer); |
| + LayerTreeHostTest::SetupTree(); |
| + } |
| + |
| + void BeginTest() override { |
| + layer_tree_host()->SetViewportSize(gfx::Size(16, 16)); |
|
danakj
2015/02/02 23:10:09
this is kinda weird, i think you should make the r
vmpstr
2015/02/02 23:32:29
Done. (made it 200x200 since 16 is kinda of arbitr
|
| + PostSetNeedsCommitToMainThread(); |
| + } |
| + |
| + void BeginCommitOnThread(LayerTreeHostImpl* host_impl) override { |
| + if (!check_results_on_commit_) |
| + return; |
| + |
| + FrameTimingTracker* tracker = host_impl->frame_timing_tracker(); |
|
danakj
2015/02/02 23:10:09
Why is this checking on the next commit instead of
vmpstr
2015/02/02 23:32:29
Added a comment. There's no real reason except tha
|
| + scoped_ptr<FrameTimingTracker::CompositeTimingSet> timing_set = |
| + tracker->GroupCountsByRectId(); |
| + EXPECT_EQ(1u, timing_set->size()); |
| + auto rect_1_it = timing_set->find(1); |
| + EXPECT_TRUE(rect_1_it != timing_set->end()); |
| + const auto& timing_events = rect_1_it->second; |
| + EXPECT_EQ(1u, timing_events.size()); |
| + EXPECT_EQ(host_impl->active_tree()->source_frame_number(), |
| + timing_events[0].frame_id); |
| + EXPECT_GT(timing_events[0].timestamp, base::TimeTicks()); |
| + |
| + EndTest(); |
| + } |
| + |
| + void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| + check_results_on_commit_ = true; |
| + PostSetNeedsCommitToMainThread(); |
| + } |
| + |
| + void AfterTest() override {} |
| + |
| + private: |
| + FakeContentLayerClient client_; |
| + bool check_results_on_commit_; |
| +}; |
| + |
| +MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestFrameTimingRequestsSaveTimestamps); |
| + |
| class LayerTreeHostTestActivationCausesPrepareTiles : public LayerTreeHostTest { |
| public: |
| LayerTreeHostTestActivationCausesPrepareTiles() |