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

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

Issue 25494009: cc: Fix disabled vsync state freezing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with test, and formatted Created 7 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 | Annotate | Revision Log
« 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 2381 matching lines...) Expand 10 before | Expand all | Expand 10 after
2392 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest, 2392 base::Bind(&LayerTreeHostTestBeginFrameNotification::EndTest,
2393 base::Unretained(this))); 2393 base::Unretained(this)));
2394 } 2394 }
2395 2395
2396 virtual void AfterTest() OVERRIDE {} 2396 virtual void AfterTest() OVERRIDE {}
2397 }; 2397 };
2398 2398
2399 MULTI_THREAD_TEST_F( 2399 MULTI_THREAD_TEST_F(
2400 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled); 2400 LayerTreeHostTestBeginFrameNotificationShutdownWhileEnabled);
2401 2401
2402 class LayerTreeHostTestAbortedCommitDoesntStallNextCommitWhenIdle 2402 class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest {
2403 : public LayerTreeHostTest {
2404 protected: 2403 protected:
2405 LayerTreeHostTestAbortedCommitDoesntStallNextCommitWhenIdle() 2404 LayerTreeHostTestAbortedCommitDoesntStall()
2406 : commit_count_(0), commit_complete_count_(0) {} 2405 : commit_count_(0), commit_complete_count_(0) {}
2407 2406
2408 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { 2407 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2409 settings->begin_frame_scheduling_enabled = true; 2408 settings->begin_frame_scheduling_enabled = true;
2410 settings->using_synchronous_renderer_compositor = true;
2411 } 2409 }
2412 2410
2413 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } 2411 virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
2414 2412
2415 virtual void DidCommit() OVERRIDE { 2413 virtual void DidCommit() OVERRIDE {
2416 commit_count_++; 2414 commit_count_++;
2417 if (commit_count_ == 2) { 2415 if (commit_count_ == 2) {
2418 // A commit was just aborted, request a real commit now to make sure a 2416 // A commit was just aborted, request a real commit now to make sure a
2419 // real commit following an aborted commit will still complete and 2417 // real commit following an aborted commit will still complete and
2420 // end the test even when the Impl thread is idle. 2418 // end the test even when the Impl thread is idle.
(...skipping 13 matching lines...) Expand all
2434 2432
2435 virtual void AfterTest() OVERRIDE { 2433 virtual void AfterTest() OVERRIDE {
2436 EXPECT_EQ(commit_count_, 3); 2434 EXPECT_EQ(commit_count_, 3);
2437 EXPECT_EQ(commit_complete_count_, 2); 2435 EXPECT_EQ(commit_complete_count_, 2);
2438 } 2436 }
2439 2437
2440 int commit_count_; 2438 int commit_count_;
2441 int commit_complete_count_; 2439 int commit_complete_count_;
2442 }; 2440 };
2443 2441
2442 class LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor
2443 : public LayerTreeHostTestAbortedCommitDoesntStall {
2444 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2445 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings);
2446 settings->using_synchronous_renderer_compositor = true;
2447 }
2448 };
2449
2444 MULTI_THREAD_TEST_F( 2450 MULTI_THREAD_TEST_F(
2445 LayerTreeHostTestAbortedCommitDoesntStallNextCommitWhenIdle); 2451 LayerTreeHostTestAbortedCommitDoesntStallSynchronousCompositor);
2452
2453 class LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync
2454 : public LayerTreeHostTestAbortedCommitDoesntStall {
2455 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2456 LayerTreeHostTestAbortedCommitDoesntStall::InitializeSettings(settings);
2457 settings->throttle_frame_production = false;
2458 }
2459 };
2460
2461 MULTI_THREAD_TEST_F(LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync);
2446 2462
2447 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation 2463 class LayerTreeHostTestUninvertibleTransformDoesNotBlockActivation
2448 : public LayerTreeHostTest { 2464 : public LayerTreeHostTest {
2449 protected: 2465 protected:
2450 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { 2466 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
2451 settings->impl_side_painting = true; 2467 settings->impl_side_painting = true;
2452 } 2468 }
2453 2469
2454 virtual void SetupTree() OVERRIDE { 2470 virtual void SetupTree() OVERRIDE {
2455 LayerTreeHostTest::SetupTree(); 2471 LayerTreeHostTest::SetupTree();
(...skipping 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 : public LayerTreeHostTestOffscreenContext { 4852 : public LayerTreeHostTestOffscreenContext {
4837 protected: 4853 protected:
4838 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; } 4854 LayerTreeHostTestOffscreenContext_WithContext() { with_context_ = true; }
4839 }; 4855 };
4840 4856
4841 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext); 4857 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestOffscreenContext_WithContext);
4842 4858
4843 } // namespace 4859 } // namespace
4844 4860
4845 } // namespace cc 4861 } // 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