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 "cc/test/web_compositor_initializer.h" | |
15 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
16 #include <public/WebThread.h> | 15 #include <public/WebThread.h> |
17 | 16 |
18 using namespace cc; | 17 using namespace cc; |
19 using namespace WebKit; | 18 using namespace WebKit; |
20 using namespace WebKitTests; | 19 using namespace WebKitTests; |
21 using testing::Test; | 20 using testing::Test; |
22 | 21 |
23 | 22 |
24 namespace { | 23 namespace { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ResourceUpdateControllerTest* m_test; | 58 ResourceUpdateControllerTest* m_test; |
60 bool m_supportShallowFlush; | 59 bool m_supportShallowFlush; |
61 }; | 60 }; |
62 | 61 |
63 | 62 |
64 class ResourceUpdateControllerTest : public Test { | 63 class ResourceUpdateControllerTest : public Test { |
65 public: | 64 public: |
66 ResourceUpdateControllerTest() | 65 ResourceUpdateControllerTest() |
67 : m_queue(make_scoped_ptr(new ResourceUpdateQueue)) | 66 : m_queue(make_scoped_ptr(new ResourceUpdateQueue)) |
68 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024,
Renderer::ContentPool)) | 67 , m_textureManager(PrioritizedTextureManager::create(60*1024*1024, 1024,
Renderer::ContentPool)) |
69 , m_compositorInitializer(m_thread.get()) | |
70 , m_fullUploadCountExpected(0) | 68 , m_fullUploadCountExpected(0) |
71 , m_partialCountExpected(0) | 69 , m_partialCountExpected(0) |
72 , m_totalUploadCountExpected(0) | 70 , m_totalUploadCountExpected(0) |
73 , m_maxUploadCountPerUpdate(0) | 71 , m_maxUploadCountPerUpdate(0) |
74 , m_numConsecutiveFlushes(0) | 72 , m_numConsecutiveFlushes(0) |
75 , m_numDanglingUploads(0) | 73 , m_numDanglingUploads(0) |
76 , m_numTotalUploads(0) | 74 , m_numTotalUploads(0) |
77 , m_numTotalFlushes(0) | 75 , m_numTotalFlushes(0) |
78 { | 76 { |
79 } | 77 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 updateController->finalize(); | 179 updateController->finalize(); |
182 } | 180 } |
183 | 181 |
184 protected: | 182 protected: |
185 // Classes required to interact and test the ResourceUpdateController | 183 // Classes required to interact and test the ResourceUpdateController |
186 scoped_ptr<GraphicsContext> m_context; | 184 scoped_ptr<GraphicsContext> m_context; |
187 scoped_ptr<ResourceProvider> m_resourceProvider; | 185 scoped_ptr<ResourceProvider> m_resourceProvider; |
188 scoped_ptr<ResourceUpdateQueue> m_queue; | 186 scoped_ptr<ResourceUpdateQueue> m_queue; |
189 scoped_ptr<PrioritizedTexture> m_textures[4]; | 187 scoped_ptr<PrioritizedTexture> m_textures[4]; |
190 scoped_ptr<WebThread> m_thread; | 188 scoped_ptr<WebThread> m_thread; |
191 WebCompositorInitializer m_compositorInitializer; | |
192 scoped_ptr<PrioritizedTextureManager> m_textureManager; | 189 scoped_ptr<PrioritizedTextureManager> m_textureManager; |
193 SkBitmap m_bitmap; | 190 SkBitmap m_bitmap; |
194 | 191 |
195 // Properties / expectations of this test | 192 // Properties / expectations of this test |
196 int m_fullUploadCountExpected; | 193 int m_fullUploadCountExpected; |
197 int m_partialCountExpected; | 194 int m_partialCountExpected; |
198 int m_totalUploadCountExpected; | 195 int m_totalUploadCountExpected; |
199 int m_maxUploadCountPerUpdate; | 196 int m_maxUploadCountPerUpdate; |
200 | 197 |
201 // Dynamic properties of this test | 198 // Dynamic properties of this test |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (thread.hasPendingTask()) | 471 if (thread.hasPendingTask()) |
475 runPendingTask(&thread, controller.get()); | 472 runPendingTask(&thread, controller.get()); |
476 } | 473 } |
477 | 474 |
478 EXPECT_FALSE(thread.hasPendingTask()); | 475 EXPECT_FALSE(thread.hasPendingTask()); |
479 EXPECT_TRUE(client.readyToFinalizeCalled()); | 476 EXPECT_TRUE(client.readyToFinalizeCalled()); |
480 EXPECT_EQ(2, m_numTotalUploads); | 477 EXPECT_EQ(2, m_numTotalUploads); |
481 } | 478 } |
482 | 479 |
483 } // namespace | 480 } // namespace |
OLD | NEW |