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

Unified Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 1287043002: cc: Setup API to release OutputSurface from LTHClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 5 years, 3 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/trees/layer_tree_host_unittest_context.cc
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 7c766fe8bedc60376fafb543e8f51667e2c40682..47481b7605770c5a062cbb2309a851884e3a28a8 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -382,6 +382,61 @@ class LayerTreeHostClientNotReadyDoesNotCreateOutputSurface
SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostClientNotReadyDoesNotCreateOutputSurface);
+class LayerTreeHostClientTakeAwayOutputSurface
+ : public LayerTreeHostContextTest {
+ public:
+ LayerTreeHostClientTakeAwayOutputSurface() : LayerTreeHostContextTest() {
+ setos_counter = 0;
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void RequestNewOutputSurface() override { CreateAndSetOutputSurface(); }
+
+ void CreateAndSetOutputSurface() {
+ scoped_ptr<OutputSurface> surface =
+ LayerTreeHostContextTest::CreateOutputSurface();
+ CHECK(surface);
+ layer_tree_host()->SetOutputSurface(surface.Pass());
+ setos_counter++;
+ }
+
+ void HideAndReleaseOutputSurface() {
+ EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+ layer_tree_host()->SetVisible(false);
+ scoped_ptr<OutputSurface> surface =
+ layer_tree_host()->ReleaseOutputSurface();
+ CHECK(surface);
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE,
+ base::Bind(&LayerTreeHostClientTakeAwayOutputSurface::MakeVisible,
+ base::Unretained(this)));
+ }
+
+ void DidInitializeOutputSurface() override {
+ if (setos_counter == 0) {
+ EXPECT_TRUE(layer_tree_host()->visible());
no sievers 2015/09/10 17:27:45 I think the reason that you were not able to move
sohanjg 2015/09/11 07:00:50 Done.
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&LayerTreeHostClientTakeAwayOutputSurface::
+ HideAndReleaseOutputSurface,
+ base::Unretained(this)));
+ } else {
+ EndTest();
+ }
+ }
+
+ void MakeVisible() {
+ EXPECT_TRUE(layer_tree_host()->proxy()->IsMainThread());
+ layer_tree_host()->SetVisible(true);
+ }
+
+ void AfterTest() override {}
+
+ int setos_counter;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostClientTakeAwayOutputSurface);
+
class MultipleCompositeDoesNotCreateOutputSurface
: public LayerTreeHostContextTest {
public:

Powered by Google App Engine
This is Rietveld 408576698