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

Side by Side Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2707243005: Discard compositor frames from unloaded web content (Closed)
Patch Set: Comments updated Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 6998 matching lines...) Expand 10 before | Expand all | Expand 10 after
7009 EXPECT_EQ(21u, frame.resource_list.size()); 7009 EXPECT_EQ(21u, frame.resource_list.size());
7010 7010
7011 EndTest(); 7011 EndTest();
7012 } 7012 }
7013 7013
7014 void AfterTest() override {} 7014 void AfterTest() override {}
7015 }; 7015 };
7016 7016
7017 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources); 7017 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestSubmitFrameResources);
7018 7018
7019 // Ensure that content_source_id is propagated to the frame's metadata.
7020 class LayerTreeHostTestContentSourceId : public LayerTreeHostTest {
7021 protected:
7022 void BeginTest() override {
7023 layer_tree_host()->SetContentSourceId(5);
7024 PostSetNeedsCommitToMainThread();
7025 }
7026
7027 DrawResult PrepareToDrawOnThread(LayerTreeHostImpl* host_impl,
7028 LayerTreeHostImpl::FrameData* frame_data,
7029 DrawResult draw_result) override {
7030 EXPECT_EQ(DRAW_SUCCESS, draw_result);
7031 EXPECT_EQ(5U, host_impl->active_tree()->content_source_id());
7032 return draw_result;
7033 }
7034
7035 void DisplayReceivedCompositorFrameOnThread(
7036 const CompositorFrame& frame) override {
7037 EXPECT_EQ(5U, frame.metadata.content_source_id);
7038 EndTest();
7039 }
7040
7041 void AfterTest() override {}
7042 };
7043
7044 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestContentSourceId);
7045
7019 } // namespace 7046 } // namespace
7020 } // namespace cc 7047 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698