OLD | NEW |
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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 query_results_available_(0), | 59 query_results_available_(0), |
60 full_upload_count_expected_(0), | 60 full_upload_count_expected_(0), |
61 partial_count_expected_(0), | 61 partial_count_expected_(0), |
62 total_upload_count_expected_(0), | 62 total_upload_count_expected_(0), |
63 max_upload_count_per_update_(0), | 63 max_upload_count_per_update_(0), |
64 num_consecutive_flushes_(0), | 64 num_consecutive_flushes_(0), |
65 num_dangling_uploads_(0), | 65 num_dangling_uploads_(0), |
66 num_total_uploads_(0), | 66 num_total_uploads_(0), |
67 num_total_flushes_(0) {} | 67 num_total_flushes_(0) {} |
68 | 68 |
69 virtual ~ResourceUpdateControllerTest() { | 69 ~ResourceUpdateControllerTest() override { |
70 DebugScopedSetImplThreadAndMainThreadBlocked | 70 DebugScopedSetImplThreadAndMainThreadBlocked |
71 impl_thread_and_main_thread_blocked(&proxy_); | 71 impl_thread_and_main_thread_blocked(&proxy_); |
72 resource_manager_->ClearAllMemory(resource_provider_.get()); | 72 resource_manager_->ClearAllMemory(resource_provider_.get()); |
73 } | 73 } |
74 | 74 |
75 public: | 75 public: |
76 void OnFlush() { | 76 void OnFlush() { |
77 // Check for back-to-back flushes. | 77 // Check for back-to-back flushes. |
78 EXPECT_EQ(0, num_consecutive_flushes_) << "Back-to-back flushes detected."; | 78 EXPECT_EQ(0, num_consecutive_flushes_) << "Back-to-back flushes detected."; |
79 | 79 |
(...skipping 19 matching lines...) Expand all Loading... |
99 | 99 |
100 bool IsQueryResultAvailable() { | 100 bool IsQueryResultAvailable() { |
101 if (!query_results_available_) | 101 if (!query_results_available_) |
102 return false; | 102 return false; |
103 | 103 |
104 query_results_available_--; | 104 query_results_available_--; |
105 return true; | 105 return true; |
106 } | 106 } |
107 | 107 |
108 protected: | 108 protected: |
109 virtual void SetUp() { | 109 void SetUp() override { |
110 bitmap_.allocN32Pixels(300, 150); | 110 bitmap_.allocN32Pixels(300, 150); |
111 | 111 |
112 for (int i = 0; i < 4; i++) { | 112 for (int i = 0; i < 4; i++) { |
113 textures_[i] = PrioritizedResource::Create(resource_manager_.get(), | 113 textures_[i] = PrioritizedResource::Create(resource_manager_.get(), |
114 gfx::Size(300, 150), | 114 gfx::Size(300, 150), |
115 RGBA_8888); | 115 RGBA_8888); |
116 textures_[i]-> | 116 textures_[i]-> |
117 set_request_priority(PriorityCalculator::VisiblePriority(true)); | 117 set_request_priority(PriorityCalculator::VisiblePriority(true)); |
118 } | 118 } |
119 resource_manager_->PrioritizeTextures(); | 119 resource_manager_->PrioritizeTextures(); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 RunPendingTask(task_runner.get(), controller.get()); | 507 RunPendingTask(task_runner.get(), controller.get()); |
508 } | 508 } |
509 | 509 |
510 EXPECT_FALSE(task_runner->HasPendingTask()); | 510 EXPECT_FALSE(task_runner->HasPendingTask()); |
511 EXPECT_TRUE(client.ReadyToFinalizeCalled()); | 511 EXPECT_TRUE(client.ReadyToFinalizeCalled()); |
512 EXPECT_EQ(2, num_total_uploads_); | 512 EXPECT_EQ(2, num_total_uploads_); |
513 } | 513 } |
514 | 514 |
515 } // namespace | 515 } // namespace |
516 } // namespace cc | 516 } // namespace cc |
OLD | NEW |