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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 resource_manager_->PrioritizeTextures(); | 120 resource_manager_->PrioritizeTextures(); |
121 | 121 |
122 output_surface_ = FakeOutputSurface::Create3d( | 122 output_surface_ = FakeOutputSurface::Create3d( |
123 scoped_ptr<TestWebGraphicsContext3D>( | 123 scoped_ptr<TestWebGraphicsContext3D>( |
124 new WebGraphicsContext3DForUploadTest(this))); | 124 new WebGraphicsContext3DForUploadTest(this))); |
125 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 125 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
126 | 126 |
127 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 127 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
128 resource_provider_ = ResourceProvider::Create(output_surface_.get(), | 128 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
129 shared_bitmap_manager_.get(), | 129 shared_bitmap_manager_.get(), |
130 NULL, | 130 nullptr, |
131 0, | 131 0, |
132 false, | 132 false, |
133 1, | 133 1, |
134 false); | 134 false); |
135 } | 135 } |
136 | 136 |
137 void AppendFullUploadsOfIndexedTextureToUpdateQueue(int count, | 137 void AppendFullUploadsOfIndexedTextureToUpdateQueue(int count, |
138 int texture_index) { | 138 int texture_index) { |
139 full_upload_count_expected_ += count; | 139 full_upload_count_expected_ += count; |
140 total_upload_count_expected_ += count; | 140 total_upload_count_expected_ += count; |
(...skipping 26 matching lines...) Expand all Loading... |
167 } | 167 } |
168 | 168 |
169 void SetMaxUploadCountPerUpdate(int count) { | 169 void SetMaxUploadCountPerUpdate(int count) { |
170 max_upload_count_per_update_ = count; | 170 max_upload_count_per_update_ = count; |
171 } | 171 } |
172 | 172 |
173 void UpdateTextures() { | 173 void UpdateTextures() { |
174 DebugScopedSetImplThreadAndMainThreadBlocked | 174 DebugScopedSetImplThreadAndMainThreadBlocked |
175 impl_thread_and_main_thread_blocked(&proxy_); | 175 impl_thread_and_main_thread_blocked(&proxy_); |
176 scoped_ptr<ResourceUpdateController> update_controller = | 176 scoped_ptr<ResourceUpdateController> update_controller = |
177 ResourceUpdateController::Create(NULL, | 177 ResourceUpdateController::Create(nullptr, |
178 proxy_.ImplThreadTaskRunner(), | 178 proxy_.ImplThreadTaskRunner(), |
179 queue_.Pass(), | 179 queue_.Pass(), |
180 resource_provider_.get()); | 180 resource_provider_.get()); |
181 update_controller->Finalize(); | 181 update_controller->Finalize(); |
182 } | 182 } |
183 | 183 |
184 void MakeQueryResultAvailable() { query_results_available_++; } | 184 void MakeQueryResultAvailable() { query_results_available_++; } |
185 | 185 |
186 protected: | 186 protected: |
187 // Classes required to interact and test the ResourceUpdateController | 187 // Classes required to interact and test the ResourceUpdateController |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 RunPendingTask(task_runner.get(), controller.get()); | 508 RunPendingTask(task_runner.get(), controller.get()); |
509 } | 509 } |
510 | 510 |
511 EXPECT_FALSE(task_runner->HasPendingTask()); | 511 EXPECT_FALSE(task_runner->HasPendingTask()); |
512 EXPECT_TRUE(client.ReadyToFinalizeCalled()); | 512 EXPECT_TRUE(client.ReadyToFinalizeCalled()); |
513 EXPECT_EQ(2, num_total_uploads_); | 513 EXPECT_EQ(2, num_total_uploads_); |
514 } | 514 } |
515 | 515 |
516 } // namespace | 516 } // namespace |
517 } // namespace cc | 517 } // namespace cc |
OLD | NEW |