| 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/debug/test_web_graphics_context_3d.h" | 8 #include "cc/debug/test_web_graphics_context_3d.h" |
| 9 #include "cc/resources/prioritized_resource_manager.h" | 9 #include "cc/resources/prioritized_resource_manager.h" |
| 10 #include "cc/test/fake_output_surface.h" | 10 #include "cc/test/fake_output_surface.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 return true; | 117 return true; |
| 118 } | 118 } |
| 119 | 119 |
| 120 protected: | 120 protected: |
| 121 virtual void SetUp() { | 121 virtual void SetUp() { |
| 122 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 300, 150); | 122 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, 300, 150); |
| 123 bitmap_.allocPixels(); | 123 bitmap_.allocPixels(); |
| 124 | 124 |
| 125 for (int i = 0; i < 4; i++) { | 125 for (int i = 0; i < 4; i++) { |
| 126 textures_[i] = PrioritizedResource::Create(resource_manager_.get(), | 126 textures_[i] = PrioritizedResource::Create(resource_manager_.get(), |
| 127 gfx::Size(300, 150), GL_RGBA); | 127 gfx::Size(300, 150), |
| 128 RGBA_8888); |
| 128 textures_[i]-> | 129 textures_[i]-> |
| 129 set_request_priority(PriorityCalculator::VisiblePriority(true)); | 130 set_request_priority(PriorityCalculator::VisiblePriority(true)); |
| 130 } | 131 } |
| 131 resource_manager_->PrioritizeTextures(); | 132 resource_manager_->PrioritizeTextures(); |
| 132 | 133 |
| 133 output_surface_ = FakeOutputSurface::Create3d( | 134 output_surface_ = FakeOutputSurface::Create3d( |
| 134 scoped_ptr<TestWebGraphicsContext3D>( | 135 scoped_ptr<TestWebGraphicsContext3D>( |
| 135 new WebGraphicsContext3DForUploadTest(this))); | 136 new WebGraphicsContext3DForUploadTest(this))); |
| 136 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 137 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
| 137 | 138 |
| 138 resource_provider_ = ResourceProvider::Create(output_surface_.get(), 0); | 139 resource_provider_ = |
| 140 ResourceProvider::Create(output_surface_.get(), 0, false); |
| 139 } | 141 } |
| 140 | 142 |
| 141 void AppendFullUploadsOfIndexedTextureToUpdateQueue(int count, | 143 void AppendFullUploadsOfIndexedTextureToUpdateQueue(int count, |
| 142 int texture_index) { | 144 int texture_index) { |
| 143 full_upload_count_expected_ += count; | 145 full_upload_count_expected_ += count; |
| 144 total_upload_count_expected_ += count; | 146 total_upload_count_expected_ += count; |
| 145 | 147 |
| 146 const gfx::Rect rect(0, 0, 300, 150); | 148 const gfx::Rect rect(0, 0, 300, 150); |
| 147 const ResourceUpdate upload = ResourceUpdate::Create( | 149 const ResourceUpdate upload = ResourceUpdate::Create( |
| 148 textures_[texture_index].get(), &bitmap_, rect, rect, gfx::Vector2d()); | 150 textures_[texture_index].get(), &bitmap_, rect, rect, gfx::Vector2d()); |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 RunPendingTask(task_runner.get(), controller.get()); | 510 RunPendingTask(task_runner.get(), controller.get()); |
| 509 } | 511 } |
| 510 | 512 |
| 511 EXPECT_FALSE(task_runner->HasPendingTask()); | 513 EXPECT_FALSE(task_runner->HasPendingTask()); |
| 512 EXPECT_TRUE(client.ReadyToFinalizeCalled()); | 514 EXPECT_TRUE(client.ReadyToFinalizeCalled()); |
| 513 EXPECT_EQ(2, num_total_uploads_); | 515 EXPECT_EQ(2, num_total_uploads_); |
| 514 } | 516 } |
| 515 | 517 |
| 516 } // namespace | 518 } // namespace |
| 517 } // namespace cc | 519 } // namespace cc |
| OLD | NEW |