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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/resource_update_controller.h" | 7 #include "cc/resource_update_controller.h" |
8 | 8 |
9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread | 9 #include "cc/single_thread_proxy.h" // For DebugScopedSetImplThread |
10 #include "cc/test/fake_web_compositor_output_surface.h" | 10 #include "cc/test/fake_web_compositor_output_surface.h" |
11 #include "cc/test/fake_web_graphics_context_3d.h" | 11 #include "cc/test/fake_web_graphics_context_3d.h" |
12 #include "cc/test/scheduler_test_common.h" | 12 #include "cc/test/scheduler_test_common.h" |
13 #include "cc/test/tiled_layer_test_common.h" | 13 #include "cc/test/tiled_layer_test_common.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 #include <public/WebThread.h> | |
16 | 15 |
17 using namespace cc; | 16 using namespace cc; |
18 using namespace WebKit; | 17 using namespace WebKit; |
19 using namespace WebKitTests; | 18 using namespace WebKitTests; |
20 using testing::Test; | 19 using testing::Test; |
21 | 20 |
22 | |
23 namespace { | 21 namespace { |
24 | 22 |
25 const int kFlushPeriodFull = 4; | 23 const int kFlushPeriodFull = 4; |
26 const int kFlushPeriodPartial = kFlushPeriodFull; | 24 const int kFlushPeriodPartial = kFlushPeriodFull; |
27 | 25 |
28 class ResourceUpdateControllerTest; | 26 class ResourceUpdateControllerTest; |
29 | 27 |
30 class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D { | 28 class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D { |
31 public: | 29 public: |
32 WebGraphicsContext3DForUploadTest(ResourceUpdateControllerTest *test) | 30 WebGraphicsContext3DForUploadTest(ResourceUpdateControllerTest *test) |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 m_resourceProvider.get()); | 176 m_resourceProvider.get()); |
179 updateController->finalize(); | 177 updateController->finalize(); |
180 } | 178 } |
181 | 179 |
182 protected: | 180 protected: |
183 // Classes required to interact and test the ResourceUpdateController | 181 // Classes required to interact and test the ResourceUpdateController |
184 scoped_ptr<GraphicsContext> m_context; | 182 scoped_ptr<GraphicsContext> m_context; |
185 scoped_ptr<ResourceProvider> m_resourceProvider; | 183 scoped_ptr<ResourceProvider> m_resourceProvider; |
186 scoped_ptr<ResourceUpdateQueue> m_queue; | 184 scoped_ptr<ResourceUpdateQueue> m_queue; |
187 scoped_ptr<PrioritizedTexture> m_textures[4]; | 185 scoped_ptr<PrioritizedTexture> m_textures[4]; |
188 scoped_ptr<WebThread> m_thread; | |
189 scoped_ptr<PrioritizedTextureManager> m_textureManager; | 186 scoped_ptr<PrioritizedTextureManager> m_textureManager; |
190 SkBitmap m_bitmap; | 187 SkBitmap m_bitmap; |
191 | 188 |
192 // Properties / expectations of this test | 189 // Properties / expectations of this test |
193 int m_fullUploadCountExpected; | 190 int m_fullUploadCountExpected; |
194 int m_partialCountExpected; | 191 int m_partialCountExpected; |
195 int m_totalUploadCountExpected; | 192 int m_totalUploadCountExpected; |
196 int m_maxUploadCountPerUpdate; | 193 int m_maxUploadCountPerUpdate; |
197 | 194 |
198 // Dynamic properties of this test | 195 // Dynamic properties of this test |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 if (thread.hasPendingTask()) | 468 if (thread.hasPendingTask()) |
472 runPendingTask(&thread, controller.get()); | 469 runPendingTask(&thread, controller.get()); |
473 } | 470 } |
474 | 471 |
475 EXPECT_FALSE(thread.hasPendingTask()); | 472 EXPECT_FALSE(thread.hasPendingTask()); |
476 EXPECT_TRUE(client.readyToFinalizeCalled()); | 473 EXPECT_TRUE(client.readyToFinalizeCalled()); |
477 EXPECT_EQ(2, m_numTotalUploads); | 474 EXPECT_EQ(2, m_numTotalUploads); |
478 } | 475 } |
479 | 476 |
480 } // anonymous namespace | 477 } // anonymous namespace |
OLD | NEW |