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 "cc/resources/prioritized_resource_manager.h" | 7 #include "cc/resources/prioritized_resource_manager.h" |
8 #include "cc/test/fake_output_surface.h" | 8 #include "cc/test/fake_output_surface.h" |
9 #include "cc/test/fake_proxy.h" | 9 #include "cc/test/fake_proxy.h" |
10 #include "cc/test/scheduler_test_common.h" | 10 #include "cc/test/scheduler_test_common.h" |
11 #include "cc/test/test_web_graphics_context_3d.h" | 11 #include "cc/test/test_web_graphics_context_3d.h" |
12 #include "cc/test/tiled_layer_test_common.h" | 12 #include "cc/test/tiled_layer_test_common.h" |
13 #include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread | 13 #include "cc/trees/single_thread_proxy.h" // For DebugScopedSetImplThread |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include "third_party/khronos/GLES2/gl2ext.h" | 15 #include "third_party/khronos/GLES2/gl2ext.h" |
16 | 16 |
17 using namespace WebKit; | |
18 using testing::Test; | 17 using testing::Test; |
| 18 using WebKit::WGC3Denum; |
| 19 using WebKit::WGC3Dint; |
| 20 using WebKit::WGC3Duint; |
| 21 using WebKit::WGC3Dsizei; |
| 22 using WebKit::WebGLId; |
| 23 using WebKit::WebString; |
19 | 24 |
20 namespace cc { | 25 namespace cc { |
21 namespace { | 26 namespace { |
22 | 27 |
23 const int kFlushPeriodFull = 4; | 28 const int kFlushPeriodFull = 4; |
24 const int kFlushPeriodPartial = kFlushPeriodFull; | 29 const int kFlushPeriodPartial = kFlushPeriodFull; |
25 | 30 |
26 class ResourceUpdateControllerTest; | 31 class ResourceUpdateControllerTest; |
27 | 32 |
28 class WebGraphicsContext3DForUploadTest : public TestWebGraphicsContext3D { | 33 class WebGraphicsContext3DForUploadTest : public TestWebGraphicsContext3D { |
29 public: | 34 public: |
30 WebGraphicsContext3DForUploadTest(ResourceUpdateControllerTest* test) | 35 explicit WebGraphicsContext3DForUploadTest(ResourceUpdateControllerTest* test) |
31 : test_(test), | 36 : test_(test), |
32 support_shallow_flush_(true) {} | 37 support_shallow_flush_(true) {} |
33 | 38 |
34 virtual void flush(void) OVERRIDE; | 39 virtual void flush(void) OVERRIDE; |
35 virtual void shallowFlushCHROMIUM(void) OVERRIDE; | 40 virtual void shallowFlushCHROMIUM(void) OVERRIDE; |
36 virtual void texSubImage2D( | 41 virtual void texSubImage2D( |
37 WGC3Denum target, | 42 WGC3Denum target, |
38 WGC3Dint level, | 43 WGC3Dint level, |
39 WGC3Dint xoffset, | 44 WGC3Dint xoffset, |
40 WGC3Dint yoffset, | 45 WGC3Dint yoffset, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 AppendPartialUploadsToUpdateQueue(partial_count); | 318 AppendPartialUploadsToUpdateQueue(partial_count); |
314 UpdateTextures(); | 319 UpdateTextures(); |
315 | 320 |
316 EXPECT_EQ(full_upload_flush_multipler + partial_upload_flush_multipler, | 321 EXPECT_EQ(full_upload_flush_multipler + partial_upload_flush_multipler, |
317 num_total_flushes_); | 322 num_total_flushes_); |
318 EXPECT_EQ(full_count + partial_count, num_total_uploads_); | 323 EXPECT_EQ(full_count + partial_count, num_total_uploads_); |
319 EXPECT_EQ(0, num_dangling_uploads_) | 324 EXPECT_EQ(0, num_dangling_uploads_) |
320 << "Last upload wasn't followed by a flush."; | 325 << "Last upload wasn't followed by a flush."; |
321 } | 326 } |
322 | 327 |
323 class FakeResourceUpdateControllerClient : | 328 class FakeResourceUpdateControllerClient |
324 public cc::ResourceUpdateControllerClient { | 329 : public cc::ResourceUpdateControllerClient { |
325 public: | 330 public: |
326 FakeResourceUpdateControllerClient() { Reset(); } | 331 FakeResourceUpdateControllerClient() { Reset(); } |
327 void Reset() { ready_to_finalize_called_ = false; } | 332 void Reset() { ready_to_finalize_called_ = false; } |
328 bool ReadyToFinalizeCalled() const { return ready_to_finalize_called_; } | 333 bool ReadyToFinalizeCalled() const { return ready_to_finalize_called_; } |
329 | 334 |
330 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE { | 335 virtual void ReadyToFinalizeTextureUpdates() OVERRIDE { |
331 ready_to_finalize_called_ = true; | 336 ready_to_finalize_called_ = true; |
332 } | 337 } |
333 | 338 |
334 protected: | 339 protected: |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 RunPendingTask(&thread, controller.get()); | 498 RunPendingTask(&thread, controller.get()); |
494 } | 499 } |
495 | 500 |
496 EXPECT_FALSE(thread.HasPendingTask()); | 501 EXPECT_FALSE(thread.HasPendingTask()); |
497 EXPECT_TRUE(client.ReadyToFinalizeCalled()); | 502 EXPECT_TRUE(client.ReadyToFinalizeCalled()); |
498 EXPECT_EQ(2, num_total_uploads_); | 503 EXPECT_EQ(2, num_total_uploads_); |
499 } | 504 } |
500 | 505 |
501 } // namespace | 506 } // namespace |
502 } // namespace cc | 507 } // namespace cc |
OLD | NEW |