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

Unified Diff: cc/trees/layer_tree_host_unittest_context.cc

Issue 871743002: cc: Fix multiple outstanding output surface requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 5 years, 11 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 | « no previous file | cc/trees/single_thread_proxy.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_context.cc
diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc
index 24ffcd46e4e3a933a2089b59773c81211692600f..49f7e170632b7b739a01631b79ae53a60856e0f1 100644
--- a/cc/trees/layer_tree_host_unittest_context.cc
+++ b/cc/trees/layer_tree_host_unittest_context.cc
@@ -411,40 +411,56 @@ class MultipleCompositeDoesNotCreateOutputSurface
SINGLE_THREAD_NOIMPL_TEST_F(MultipleCompositeDoesNotCreateOutputSurface);
+// This test makes sure that once a SingleThreadProxy issues a
+// DidFailToInitializeOutputSurface, that future Composite calls will not
+// trigger additional requests for output surfaces.
class FailedCreateDoesNotCreateExtraOutputSurface
: public LayerTreeHostContextTest {
public:
FailedCreateDoesNotCreateExtraOutputSurface()
- : LayerTreeHostContextTest(), request_count_(0) {}
+ : LayerTreeHostContextTest(), num_requests_(0), has_failed_(false) {}
void InitializeSettings(LayerTreeSettings* settings) override {
settings->single_thread_proxy_scheduler = false;
}
void RequestNewOutputSurface() override {
- if (request_count_ == 0) {
- ExpectCreateToFail();
- layer_tree_host()->SetOutputSurface(
- make_scoped_ptr(new FailureOutputSurface(false)));
- }
+ num_requests_++;
+ // There should be one initial request and then one request from
+ // the LayerTreeTest test hooks DidFailToInitializeOutputSurface (which is
+ // hard to skip). This second request is just ignored and is test cruft.
+ EXPECT_LE(num_requests_, 2);
+ if (num_requests_ > 1)
+ return;
+ ExpectCreateToFail();
+ layer_tree_host()->SetOutputSurface(
+ make_scoped_ptr(new FailureOutputSurface(false)));
}
void BeginTest() override {
+ // First composite tries to create a surface.
layer_tree_host()->Composite(base::TimeTicks());
+ EXPECT_EQ(num_requests_, 2);
+ EXPECT_TRUE(has_failed_);
+
+ // Second composite should not request or fail.
layer_tree_host()->Composite(base::TimeTicks());
+ EXPECT_EQ(num_requests_, 2);
+ EndTest();
}
void DidInitializeOutputSurface() override { EXPECT_TRUE(false); }
void DidFailToInitializeOutputSurface() override {
LayerTreeHostContextTest::DidFailToInitializeOutputSurface();
- EXPECT_GE(2, ++request_count_);
- EndTest();
+ EXPECT_FALSE(has_failed_);
+ has_failed_ = true;
}
void AfterTest() override {}
- int request_count_;
+ int num_requests_;
+ bool has_failed_;
};
SINGLE_THREAD_NOIMPL_TEST_F(FailedCreateDoesNotCreateExtraOutputSurface);
« no previous file with comments | « no previous file | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698