OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 6223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6234 0, ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING); | 6234 0, ManagedMemoryPolicy::CUTOFF_ALLOW_NOTHING); |
6235 host_impl_->SetMemoryPolicy(policy2, false); | 6235 host_impl_->SetMemoryPolicy(policy2, false); |
6236 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); | 6236 EXPECT_EQ(actual_policy, host_impl_->ActualManagedMemoryPolicy()); |
6237 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); | 6237 EXPECT_EQ(policy1.bytes_limit_when_visible, current_limit_bytes_); |
6238 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); | 6238 EXPECT_EQ(visible_cutoff_value, current_priority_cutoff_value_); |
6239 host_impl_->SetVisible(false); | 6239 host_impl_->SetVisible(false); |
6240 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); | 6240 EXPECT_EQ(policy1.bytes_limit_when_not_visible, current_limit_bytes_); |
6241 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); | 6241 EXPECT_EQ(not_visible_cutoff_value, current_priority_cutoff_value_); |
6242 } | 6242 } |
6243 | 6243 |
6244 TEST_F(LayerTreeHostImplTest, UIResourceManagement) { | |
aelias_OOO_until_Jul13
2013/07/31 21:00:30
Add a test case for two creations with the same UI
powei
2013/07/31 21:29:39
Done.
| |
6245 scoped_ptr<TestWebGraphicsContext3D> context = | |
6246 TestWebGraphicsContext3D::Create(); | |
6247 TestWebGraphicsContext3D* context3d = context.get(); | |
6248 scoped_ptr<OutputSurface> output_surface = FakeOutputSurface::Create3d( | |
6249 context.PassAs<WebKit::WebGraphicsContext3D>()).PassAs<OutputSurface>(); | |
6250 host_impl_->InitializeRenderer(output_surface.Pass()); | |
6251 | |
6252 EXPECT_EQ(0u, context3d->NumTextures()); | |
6253 | |
6254 UIResourceId ui_resource_id = 1; | |
6255 scoped_refptr<UIResourceBitmap> bitmap = | |
6256 UIResourceBitmap::Create(new uint8_t[1], | |
6257 UIResourceBitmap::RGBA8, | |
6258 gfx::Size(1, 1)); | |
6259 host_impl_->CreateUIResource(ui_resource_id, bitmap); | |
6260 EXPECT_EQ(1u, context3d->NumTextures()); | |
6261 ResourceProvider::ResourceId id = | |
6262 host_impl_->ResourceIdForUIResource(ui_resource_id); | |
6263 EXPECT_NE(0u, id); | |
6264 EXPECT_EQ(ResourceProvider::GLTexture, | |
6265 host_impl_->resource_provider()->GetResourceType(id)); | |
6266 | |
6267 // Should return zero for invalid UIResourceId. Number of textures should | |
6268 // not change. | |
6269 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(-1)); | |
6270 EXPECT_EQ(1u, context3d->NumTextures()); | |
6271 | |
6272 host_impl_->DeleteUIResource(ui_resource_id); | |
enne (OOO)
2013/07/31 22:02:40
Could you delete an invalid resource id here too?
powei
2013/08/01 00:05:10
Done.
| |
6273 EXPECT_EQ(0u, host_impl_->ResourceIdForUIResource(ui_resource_id)); | |
6274 EXPECT_EQ(0u, context3d->NumTextures()); | |
6275 | |
6276 // Should not change state for multiple deletion on one UIResourceId | |
6277 host_impl_->DeleteUIResource(ui_resource_id); | |
6278 EXPECT_EQ(0u, context3d->NumTextures()); | |
6279 } | |
6280 | |
6244 } // namespace | 6281 } // namespace |
6245 } // namespace cc | 6282 } // namespace cc |
OLD | NEW |