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

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: Created 5 years, 2 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 unified diff | Download patch
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);
303 EXPECT_EQ(false,
304 ThreadProxyImplOnly().next_commit_waits_for_activation);
305 break;
306 case 1:
307 // The second commit should be held until activation.
308 EXPECT_NE(nullptr, ThreadProxyImplOnly().commit_completion_event);
309 EXPECT_EQ(true, ThreadProxyImplOnly().next_commit_waits_for_activation);
310 break;
311 case 2:
312 // The third commit should not wait for activation.
313 EXPECT_EQ(nullptr, ThreadProxyImplOnly().commit_completion_event);
314 EXPECT_EQ(false,
315 ThreadProxyImplOnly().next_commit_waits_for_activation);
316 }
317 }
318
319 void DidActivateSyncTree() override {
320 // The next_commit_waits_for_activation should have been cleared after the
321 // sync tree is activated.
322 EXPECT_EQ(false, ThreadProxyImplOnly().next_commit_waits_for_activation);
323 }
324
325 void DidCommit() override {
326 switch (commits_completed_) {
327 case 0:
328 // The first commit has been completed. Set next commit waits for
329 // activation and start another commit.
330 commits_completed_++;
331 proxy()->SetNextCommitWaitsForActivation();
332 proxy()->SetNeedsCommit();
333 case 1:
334 // Start another commit to verify that this is not held until
335 // activation.
336 commits_completed_++;
337 proxy()->SetNeedsCommit();
338 case 2:
339 commits_completed_++;
340 EndTest();
341 }
342 }
343
344 void AfterTest() override { EXPECT_EQ(3, commits_completed_); }
345
346 private:
347 int commits_completed_;
348
349 DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestCommitWaitsForActivation);
350 };
351
352 THREAD_PROXY_TEST_F(ThreadProxyTestCommitWaitsForActivation);
353
290 } // namespace cc 354 } // namespace cc
OLDNEW
« cc/trees/channel_main.h ('K') | « 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