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

Side by Side Diff: cc/trees/layer_tree_host_unittest_proxy.cc

Issue 1418953002: cc: Send shared variables between main and impl side using the channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments. Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « cc/trees/channel_main.h ('k') | cc/trees/proxy_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "cc/test/fake_content_layer_client.h" 7 #include "cc/test/fake_content_layer_client.h"
8 #include "cc/test/fake_picture_layer.h" 8 #include "cc/test/fake_picture_layer.h"
9 #include "cc/test/layer_tree_test.h" 9 #include "cc/test/layer_tree_test.h"
10 #include "cc/trees/thread_proxy.h" 10 #include "cc/trees/thread_proxy.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 EXPECT_EQ(1, update_check_layer_->update_count()); 280 EXPECT_EQ(1, update_check_layer_->update_count());
281 EndTest(); 281 EndTest();
282 } 282 }
283 283
284 private: 284 private:
285 DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestSetNeedsCommitWhileAnimating); 285 DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestSetNeedsCommitWhileAnimating);
286 }; 286 };
287 287
288 THREAD_PROXY_TEST_F(ThreadProxyTestSetNeedsCommitWhileAnimating); 288 THREAD_PROXY_TEST_F(ThreadProxyTestSetNeedsCommitWhileAnimating);
289 289
290 class ThreadProxyTestCommitWaitsForActivation : public ThreadProxyTest {
291 protected:
292 ThreadProxyTestCommitWaitsForActivation() : commits_completed_(0) {}
293 ~ThreadProxyTestCommitWaitsForActivation() override {}
294
295 void BeginTest() override { proxy()->SetNeedsCommit(); }
296
297 void ScheduledActionCommit() override {
298 switch (commits_completed_) {
299 case 0:
300 // The first commit does not wait for activation. Verify that the
301 // completion event is cleared.
302 EXPECT_EQ(nullptr, ThreadProxyImplOnly().commit_completion_event);
vmpstr 2015/11/03 19:50:55 nit: We usually use EXPECT_TRUE/EXPECT_FALSE for n
Khushal 2015/11/03 20:03:05 Done.
303 EXPECT_FALSE(ThreadProxyImplOnly().next_commit_waits_for_activation);
304 break;
305 case 1:
306 // The second commit should be held until activation.
307 EXPECT_NE(nullptr, ThreadProxyImplOnly().commit_completion_event);
vmpstr 2015/11/03 19:50:55 Here as well.
Khushal 2015/11/03 20:03:05 Done.
308 EXPECT_TRUE(ThreadProxyImplOnly().next_commit_waits_for_activation);
309 break;
310 case 2:
311 // The third commit should not wait for activation.
312 EXPECT_EQ(nullptr, ThreadProxyImplOnly().commit_completion_event);
vmpstr 2015/11/03 19:50:55 Here as well.
Khushal 2015/11/03 20:03:05 Done.
313 EXPECT_FALSE(ThreadProxyImplOnly().next_commit_waits_for_activation);
314 }
315 }
316
317 void DidActivateSyncTree() override {
318 // The next_commit_waits_for_activation should have been cleared after the
319 // sync tree is activated.
320 EXPECT_FALSE(ThreadProxyImplOnly().next_commit_waits_for_activation);
321 }
322
323 void DidCommit() override {
324 switch (commits_completed_) {
325 case 0:
326 // The first commit has been completed. Set next commit waits for
327 // activation and start another commit.
328 commits_completed_++;
David Trainor- moved to gerrit 2015/11/02 16:19:44 Pull this out of the switch? Otherwise if you som
Khushal 2015/11/02 17:02:54 The AfterTest should catch that right? It makes su
329 proxy()->SetNextCommitWaitsForActivation();
330 proxy()->SetNeedsCommit();
331 case 1:
332 // Start another commit to verify that this is not held until
333 // activation.
334 commits_completed_++;
335 proxy()->SetNeedsCommit();
336 case 2:
337 commits_completed_++;
338 EndTest();
339 }
340 }
341
342 void AfterTest() override { EXPECT_EQ(3, commits_completed_); }
343
344 private:
345 int commits_completed_;
346
347 DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestCommitWaitsForActivation);
348 };
349
350 THREAD_PROXY_TEST_F(ThreadProxyTestCommitWaitsForActivation);
351
290 } // namespace cc 352 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/channel_main.h ('k') | cc/trees/proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698