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

Side by Side Diff: cc/resources/resource_update_controller_unittest.cc

Issue 190543012: cc: Don't call ReadyToFinalizeTextureUpdates multiple times (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 9 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/resources/resource_update_controller.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 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/resources/resource_update_controller.h" 5 #include "cc/resources/resource_update_controller.h"
6 6
7 #include "base/test/test_simple_task_runner.h" 7 #include "base/test/test_simple_task_runner.h"
8 #include "cc/resources/prioritized_resource_manager.h" 8 #include "cc/resources/prioritized_resource_manager.h"
9 #include "cc/test/fake_output_surface.h" 9 #include "cc/test/fake_output_surface.h"
10 #include "cc/test/fake_output_surface_client.h" 10 #include "cc/test/fake_output_surface_client.h"
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 controller->SetUpdateTextureTime(base::TimeDelta::FromMilliseconds(100)); 448 controller->SetUpdateTextureTime(base::TimeDelta::FromMilliseconds(100));
449 controller->SetUpdateMoreTexturesSize(1); 449 controller->SetUpdateMoreTexturesSize(1);
450 // Enough time for 3 updates but only 2 necessary. 450 // Enough time for 3 updates but only 2 necessary.
451 controller->PerformMoreUpdates(controller->Now() + 451 controller->PerformMoreUpdates(controller->Now() +
452 base::TimeDelta::FromMilliseconds(310)); 452 base::TimeDelta::FromMilliseconds(310));
453 RunPendingTask(task_runner.get(), controller.get()); 453 RunPendingTask(task_runner.get(), controller.get());
454 EXPECT_FALSE(task_runner->HasPendingTask()); 454 EXPECT_FALSE(task_runner->HasPendingTask());
455 EXPECT_TRUE(client.ReadyToFinalizeCalled()); 455 EXPECT_TRUE(client.ReadyToFinalizeCalled());
456 EXPECT_EQ(2, num_total_uploads_); 456 EXPECT_EQ(2, num_total_uploads_);
457 457
458 client.Reset();
458 controller->SetUpdateTextureTime(base::TimeDelta::FromMilliseconds(100)); 459 controller->SetUpdateTextureTime(base::TimeDelta::FromMilliseconds(100));
459 controller->SetUpdateMoreTexturesSize(1); 460 controller->SetUpdateMoreTexturesSize(1);
460 // Enough time for updates but no more updates left. 461 // Enough time for updates but no more updates left.
461 controller->PerformMoreUpdates(controller->Now() + 462 controller->PerformMoreUpdates(controller->Now() +
462 base::TimeDelta::FromMilliseconds(310)); 463 base::TimeDelta::FromMilliseconds(310));
463 // 0-delay task used to call ReadyToFinalizeTextureUpdates(). 464
464 RunPendingTask(task_runner.get(), controller.get()); 465 // ReadyToFinalizeTextureUpdates should only be called once.
465 EXPECT_FALSE(task_runner->HasPendingTask()); 466 EXPECT_FALSE(task_runner->HasPendingTask());
466 EXPECT_TRUE(client.ReadyToFinalizeCalled()); 467 EXPECT_FALSE(client.ReadyToFinalizeCalled());
467 EXPECT_EQ(2, num_total_uploads_); 468 EXPECT_EQ(2, num_total_uploads_);
468 } 469 }
469 470
470 TEST_F(ResourceUpdateControllerTest, UpdatesCompleteInFiniteTime) { 471 TEST_F(ResourceUpdateControllerTest, UpdatesCompleteInFiniteTime) {
471 FakeResourceUpdateControllerClient client; 472 FakeResourceUpdateControllerClient client;
472 scoped_refptr<base::TestSimpleTaskRunner> task_runner = 473 scoped_refptr<base::TestSimpleTaskRunner> task_runner =
473 new base::TestSimpleTaskRunner; 474 new base::TestSimpleTaskRunner;
474 475
475 SetMaxUploadCountPerUpdate(1); 476 SetMaxUploadCountPerUpdate(1);
476 AppendFullUploadsToUpdateQueue(2); 477 AppendFullUploadsToUpdateQueue(2);
(...skipping 23 matching lines...) Expand all
500 RunPendingTask(task_runner.get(), controller.get()); 501 RunPendingTask(task_runner.get(), controller.get());
501 } 502 }
502 503
503 EXPECT_FALSE(task_runner->HasPendingTask()); 504 EXPECT_FALSE(task_runner->HasPendingTask());
504 EXPECT_TRUE(client.ReadyToFinalizeCalled()); 505 EXPECT_TRUE(client.ReadyToFinalizeCalled());
505 EXPECT_EQ(2, num_total_uploads_); 506 EXPECT_EQ(2, num_total_uploads_);
506 } 507 }
507 508
508 } // namespace 509 } // namespace
509 } // namespace cc 510 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_update_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698