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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1292773003: Queue latency info swap promises in a separate already-active queue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use different return value for failed draw in test, to avoid NOTREACHED() Created 5 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_impl.h » ('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 8e569a521c1c06698c179ce75388c5a07eebbba4..efce41f46f0c27cc88b9f02fe7bf26d69eeb491a 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -3925,7 +3925,6 @@ class TestSwapPromise : public SwapPromise {
void DidSwap(CompositorFrameMetadata* metadata) override {
base::AutoLock lock(result_->lock);
- EXPECT_TRUE(result_->did_activate_called);
EXPECT_FALSE(result_->did_swap_called);
EXPECT_FALSE(result_->did_not_swap_called);
result_->did_swap_called = true;
@@ -3948,6 +3947,53 @@ class TestSwapPromise : public SwapPromise {
TestSwapPromiseResult* result_;
};
+class PinnedLayerTreeSwapPromise : public LayerTreeHostTest {
+ protected:
+ void BeginTest() override {
+ PostSetNextCommitForcesRedrawToMainThread();
+ PostSetNeedsCommitToMainThread();
+ }
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
+ int frame = host_impl->active_tree()->source_frame_number();
+ if (frame == -1) {
+ host_impl->active_tree()->QueuePinnedSwapPromise(make_scoped_ptr(
+ new TestSwapPromise(&pinned_active_swap_promise_result_)));
+ host_impl->pending_tree()->QueueSwapPromise(
+ make_scoped_ptr(new TestSwapPromise(&pending_swap_promise_result_)));
+ host_impl->active_tree()->QueueSwapPromise(
+ make_scoped_ptr(new TestSwapPromise(&active_swap_promise_result_)));
+ }
+ }
+
+ void SwapBuffersOnThread(LayerTreeHostImpl* host_impl, bool result) override {
+ EndTest();
+ }
+
+ void AfterTest() override {
+ // The pending swap promise should activate and swap.
+ EXPECT_TRUE(pending_swap_promise_result_.did_activate_called);
+ EXPECT_TRUE(pending_swap_promise_result_.did_swap_called);
+
+ // The active swap promise should fail to swap (it is cancelled by
+ // the activation of a new frame).
+ EXPECT_FALSE(active_swap_promise_result_.did_activate_called);
+ EXPECT_FALSE(active_swap_promise_result_.did_swap_called);
+ EXPECT_TRUE(active_swap_promise_result_.did_not_swap_called);
+ EXPECT_EQ(active_swap_promise_result_.reason, SwapPromise::SWAP_FAILS);
+
+ // The pinned active swap promise should not activate, but should swap.
+ EXPECT_FALSE(pinned_active_swap_promise_result_.did_activate_called);
+ EXPECT_TRUE(pinned_active_swap_promise_result_.did_swap_called);
+ }
+
+ TestSwapPromiseResult pending_swap_promise_result_;
+ TestSwapPromiseResult active_swap_promise_result_;
+ TestSwapPromiseResult pinned_active_swap_promise_result_;
+};
+
+MULTI_THREAD_TEST_F(PinnedLayerTreeSwapPromise);
+
class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
protected:
LayerTreeHostTestBreakSwapPromise()
« no previous file with comments | « cc/trees/layer_tree_host_impl_unittest.cc ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698