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

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

Issue 23463014: cc: Poll for state that triggers draws (synchronous compositor only) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: add more test expectations; formatting; Created 7 years, 3 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, 2397 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest,
2398 base::Unretained(this))); 2398 base::Unretained(this)));
2399 } 2399 }
2400 2400
2401 virtual void AfterTest() OVERRIDE {} 2401 virtual void AfterTest() OVERRIDE {}
2402 }; 2402 };
2403 2403
2404 MULTI_THREAD_TEST_F( 2404 MULTI_THREAD_TEST_F(
2405 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); 2405 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled);
2406 2406
2407 class LayerTreeHostTestAbortedCommitDoesntStallNextCommitWhenIdle
2408 : public LayerTreeHostTest {
2409 protected:
2410 LayerTreeHostTestAbortedCommitDoesntStallNextCommitWhenIdle()
2411 : commit_count_(0), commit_complete_count_(0) {}
2412
2413 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2414 settings->begin_frame_scheduling_enabled = true;
2415 settings->using_synchronous_renderer_compositor = true;
2416 }
2417
2418 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
2419
2420 virtual void DidCommit() OVERRIDE {
2421 commit_count_++;
2422 if (commit_count_ == 2) {
2423 // A commit was just aborted, request a real commit now to make sure a
2424 // real commit following an aborted commit will still complete and
2425 // end the test even when the Impl thread is idle.
2426 layer_tree_host()->SetNeedsCommit();
2427 }
2428 }
2429
2430 virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
2431 commit_complete_count_++;
2432 if (commit_complete_count_ == 1) {
2433 // Initiate an aborted commit after the first commit.
2434 host_impl->SetNeedsCommit();
2435 } else {
2436 EndTest();
2437 }
2438 }
2439
2440 virtual void AfterTest() OVERRIDE {
2441 EXPECT_EQ(commit_count_, 3);
2442 EXPECT_EQ(commit_complete_count_, 2);
2443 }
2444
2445 int commit_count_;
2446 int commit_complete_count_;
2447 };
2448
2449 MULTI_THREAD_TEST_F(
2450 LayerTreeHostTestAbortedCommitDoesntStallNextCommitWhenIdle);
2451
2407 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation 2452 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
2408 : public LayerTreeHostTest { 2453 : public LayerTreeHostTest {
2409 protected: 2454 protected:
2410 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { 2455 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2411 settings->impl_side_painting = true; 2456 settings->impl_side_painting = true;
2412 } 2457 }
2413 2458
2414 virtual void SetupTree() OVERRIDE { 2459 virtual void SetupTree() OVERRIDE {
2415 LayerTreeHostTest::SetupTree(); 2460 LayerTreeHostTest::SetupTree();
2416 2461
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after
4640 scoped_refptr<TestContextProvider> context_provider_; 4685 scoped_refptr<TestContextProvider> context_provider_;
4641 FakeContentLayerClient client_; 4686 FakeContentLayerClient client_;
4642 }; 4687 };
4643 4688
4644 // Impl-side painting is a multi-threaded compositor feature. 4689 // Impl-side painting is a multi-threaded compositor feature.
4645 MULTI_THREAD_TEST_F(LayerTreeHostTestMaxTransferBufferUsageBytes); 4690 MULTI_THREAD_TEST_F(LayerTreeHostTestMaxTransferBufferUsageBytes);
4646 4691
4647 } // namespace 4692 } // namespace
4648 4693
4649 } // namespace cc 4694 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler_state_machine.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698