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

Unified Diff: cc/trees/remote_channel_unittest.cc

Issue 1954293002: Fixed a cc unittest for swap buffer change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/remote_channel_unittest.cc
diff --git a/cc/trees/remote_channel_unittest.cc b/cc/trees/remote_channel_unittest.cc
index 79e6a3d768d7454873cba19c90765310e37601e9..e7a0ef0e91c6e6c8953c2b4a51019a47c5c7fe84 100644
--- a/cc/trees/remote_channel_unittest.cc
+++ b/cc/trees/remote_channel_unittest.cc
@@ -9,7 +9,8 @@ namespace cc {
class RemoteChannelTest : public LayerTreeTest {
protected:
- RemoteChannelTest() : calls_received_(0) {}
+ RemoteChannelTest()
+ : calls_received_(0), calls_received_on_both_server_and_client_(0) {}
Khushal 2016/05/06 21:37:54 How about splitting this into calls_received_on_cl
shaktisahu 2016/05/07 00:46:12 Yea, but it is hard to know if the call is receive
Khushal 2016/05/09 09:06:33 Sorry, I meant we could split it into calls_expect
vmpstr 2016/05/10 18:27:32 I would prefer that we don't have any "server and
Khushal 2016/05/10 19:11:31 The LayerTreeTests keep an instance of both the se
~RemoteChannelTest() override {}
@@ -21,6 +22,11 @@ class RemoteChannelTest : public LayerTreeTest {
int calls_received_;
+ // Since LayerTreeHost on engine and client share a common LayerTreeHostClient
+ // for unit tests, there are some functions called twice. This variable keep
+ // tracks of those function calls.
+ int calls_received_on_both_server_and_client_;
+
private:
DISALLOW_COPY_AND_ASSIGN(RemoteChannelTest);
};
@@ -140,8 +146,8 @@ class RemoteChannelTestCommit : public RemoteChannelTest {
void DidCommitAndDrawFrame() override { EXPECT_EQ(3, calls_received_++); }
void DidCompleteSwapBuffers() override {
- EXPECT_EQ(4, calls_received_++);
- EndTest();
+ if (++calls_received_on_both_server_and_client_ == 2)
+ EndTest();
}
void WillCommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
@@ -151,7 +157,8 @@ class RemoteChannelTestCommit : public RemoteChannelTest {
}
void AfterTest() override {
- EXPECT_EQ(5, calls_received_);
+ EXPECT_EQ(4, calls_received_);
+ EXPECT_EQ(2, calls_received_on_both_server_and_client_);
}
const gfx::Size viewport_size_ = gfx::Size(5, 3);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698