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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 240163005: Deliver IPC messages together with SwapCompositorFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: introduce a separate queue for with_swap messages Created 6 years, 6 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.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index b194491d7606763193f75e034c965c5b022ebeb7..3d32cbcbcdfb02bdb811a53827f408929d642a27 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -4484,11 +4484,11 @@ class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
}
{
- // The second commit aborts.
+ // The second commit is aborted since it contains no updates.
base::AutoLock lock(swap_promise_result_[1].lock);
EXPECT_FALSE(swap_promise_result_[1].did_swap_called);
EXPECT_TRUE(swap_promise_result_[1].did_not_swap_called);
- EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_[1].reason);
+ EXPECT_EQ(SwapPromise::COMMIT_NO_UPDATE, swap_promise_result_[1].reason);
EXPECT_TRUE(swap_promise_result_[1].dtor_called);
}
@@ -4510,6 +4510,53 @@ class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
+class LayerTreeHostTestBreakSwapPromiseForAbortedCommit
+ : public LayerTreeHostTest {
+ protected:
+ LayerTreeHostTestBreakSwapPromiseForAbortedCommit() : commit_count_(0) {}
+
+ virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
+ settings->throttle_frame_production = false;
+ }
+
+ virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
+
+ virtual void DidCommit() OVERRIDE {
+ commit_count_++;
+ if (commit_count_ == 1) {
+ scoped_ptr<SwapPromise> swap_promise(
+ new TestSwapPromise(&swap_promise_result_));
+ layer_tree_host()->QueueSwapPromise(swap_promise.Pass());
+ }
+ }
+
+ virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
+ bool did_handle) OVERRIDE {
+ EndTest();
+ }
+
+ virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
+ // Initiate an abortable commit.
piman 2014/06/25 21:20:32 What causes this commit to be aborted?
mkosiba (inactive) 2014/06/25 22:08:33 I'd be thrilled to know too, to be honest. I spent
mkosiba (inactive) 2014/06/26 12:36:47 Ok, so I think this has something to do with the s
piman 2014/06/26 20:40:12 Mmh, I think the case where that happens is the Ea
mkosiba (inactive) 2014/06/27 14:18:59 That works, thanks!
+ host_impl->SetNeedsCommit();
+ }
+
+ virtual void AfterTest() OVERRIDE {
+ EXPECT_EQ(commit_count_, 2);
+ {
+ base::AutoLock lock(swap_promise_result_.lock);
+ EXPECT_FALSE(swap_promise_result_.did_swap_called);
+ EXPECT_TRUE(swap_promise_result_.did_not_swap_called);
+ EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_.reason);
+ EXPECT_TRUE(swap_promise_result_.dtor_called);
+ }
+ }
+
+ int commit_count_;
+ TestSwapPromiseResult swap_promise_result_;
+};
+
+MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForAbortedCommit);
+
class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
public:
SimpleSwapPromiseMonitor(LayerTreeHost* layer_tree_host,

Powered by Google App Engine
This is Rietveld 408576698