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

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

Issue 871743002: cc: Fix multiple outstanding output surface requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 5 years, 11 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 | « no previous file | cc/trees/single_thread_proxy.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "cc/layers/content_layer.h" 8 #include "cc/layers/content_layer.h"
9 #include "cc/layers/delegated_frame_provider.h" 9 #include "cc/layers/delegated_frame_provider.h"
10 #include "cc/layers/delegated_frame_resource_collection.h" 10 #include "cc/layers/delegated_frame_resource_collection.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 404
405 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } 405 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); }
406 406
407 void AfterTest() override {} 407 void AfterTest() override {}
408 408
409 int request_count_; 409 int request_count_;
410 }; 410 };
411 411
412 SINGLE_THREAD_NOIMPL_TEST_F(MultipleCompositeDoesNotCreateOutputSurface); 412 SINGLE_THREAD_NOIMPL_TEST_F(MultipleCompositeDoesNotCreateOutputSurface);
413 413
414 // This test makes sure that once a SingleThreadProxy issues a
415 // DidFailToInitializeOutputSurface, that future Composite calls will not
416 // trigger additional requests for output surfaces.
414 class FailedCreateDoesNotCreateExtraOutputSurface 417 class FailedCreateDoesNotCreateExtraOutputSurface
415 : public LayerTreeHostContextTest { 418 : public LayerTreeHostContextTest {
416 public: 419 public:
417 FailedCreateDoesNotCreateExtraOutputSurface() 420 FailedCreateDoesNotCreateExtraOutputSurface()
418 : LayerTreeHostContextTest(), request_count_(0) {} 421 : LayerTreeHostContextTest(), num_requests_(0), has_failed_(false) {}
419 422
420 void InitializeSettings(LayerTreeSettings* settings) override { 423 void InitializeSettings(LayerTreeSettings* settings) override {
421 settings->single_thread_proxy_scheduler = false; 424 settings->single_thread_proxy_scheduler = false;
422 } 425 }
423 426
424 void RequestNewOutputSurface() override { 427 void RequestNewOutputSurface() override {
425 if (request_count_ == 0) { 428 num_requests_++;
426 ExpectCreateToFail(); 429 // There should be one initial request and then one request from
427 layer_tree_host()->SetOutputSurface( 430 // the LayerTreeTest test hooks DidFailToInitializeOutputSurface (which is
428 make_scoped_ptr(new FailureOutputSurface(false))); 431 // hard to skip). This second request is just ignored and is test cruft.
429 } 432 EXPECT_LE(num_requests_, 2);
433 if (num_requests_ > 1)
434 return;
435 ExpectCreateToFail();
436 layer_tree_host()->SetOutputSurface(
437 make_scoped_ptr(new FailureOutputSurface(false)));
430 } 438 }
431 439
432 void BeginTest() override { 440 void BeginTest() override {
441 // First composite tries to create a surface.
433 layer_tree_host()->Composite(base::TimeTicks()); 442 layer_tree_host()->Composite(base::TimeTicks());
443 EXPECT_EQ(num_requests_, 2);
444 EXPECT_TRUE(has_failed_);
445
446 // Second composite should not request or fail.
434 layer_tree_host()->Composite(base::TimeTicks()); 447 layer_tree_host()->Composite(base::TimeTicks());
448 EXPECT_EQ(num_requests_, 2);
449 EndTest();
435 } 450 }
436 451
437 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); } 452 void DidInitializeOutputSurface() override { EXPECT_TRUE(false); }
438 453
439 void DidFailToInitializeOutputSurface() override { 454 void DidFailToInitializeOutputSurface() override {
440 LayerTreeHostContextTest::DidFailToInitializeOutputSurface(); 455 LayerTreeHostContextTest::DidFailToInitializeOutputSurface();
441 EXPECT_GE(2, ++request_count_); 456 EXPECT_FALSE(has_failed_);
442 EndTest(); 457 has_failed_ = true;
443 } 458 }
444 459
445 void AfterTest() override {} 460 void AfterTest() override {}
446 461
447 int request_count_; 462 int num_requests_;
463 bool has_failed_;
448 }; 464 };
449 465
450 SINGLE_THREAD_NOIMPL_TEST_F(FailedCreateDoesNotCreateExtraOutputSurface); 466 SINGLE_THREAD_NOIMPL_TEST_F(FailedCreateDoesNotCreateExtraOutputSurface);
451 467
452 class LayerTreeHostContextTestCommitAfterDelayedOutputSurface 468 class LayerTreeHostContextTestCommitAfterDelayedOutputSurface
453 : public LayerTreeHostContextTest { 469 : public LayerTreeHostContextTest {
454 public: 470 public:
455 LayerTreeHostContextTestCommitAfterDelayedOutputSurface() 471 LayerTreeHostContextTestCommitAfterDelayedOutputSurface()
456 : LayerTreeHostContextTest(), creating_output_(false) {} 472 : LayerTreeHostContextTest(), creating_output_(false) {}
457 473
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1800 void AfterTest() override {} 1816 void AfterTest() override {}
1801 1817
1802 bool deferred_; 1818 bool deferred_;
1803 }; 1819 };
1804 1820
1805 SINGLE_AND_MULTI_THREAD_TEST_F( 1821 SINGLE_AND_MULTI_THREAD_TEST_F(
1806 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame); 1822 LayerTreeHostContextTestLoseAfterSendingBeginMainFrame);
1807 1823
1808 } // namespace 1824 } // namespace
1809 } // namespace cc 1825 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698