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/scoped_resource.h" | 5 #include "cc/resources/scoped_resource.h" |
6 | 6 |
7 #include "cc/output/renderer.h" | 7 #include "cc/output/renderer.h" |
8 #include "cc/test/fake_output_surface.h" | 8 #include "cc/test/fake_output_surface.h" |
9 #include "cc/test/fake_output_surface_client.h" | 9 #include "cc/test/fake_output_surface_client.h" |
10 #include "cc/test/test_shared_bitmap_manager.h" | 10 #include "cc/test/test_shared_bitmap_manager.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 EXPECT_EQ(0u, texture->bytes()); | 40 EXPECT_EQ(0u, texture->bytes()); |
41 } | 41 } |
42 | 42 |
43 TEST(ScopedResourceTest, CreateScopedResource) { | 43 TEST(ScopedResourceTest, CreateScopedResource) { |
44 FakeOutputSurfaceClient output_surface_client; | 44 FakeOutputSurfaceClient output_surface_client; |
45 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); | 45 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d()); |
46 CHECK(output_surface->BindToClient(&output_surface_client)); | 46 CHECK(output_surface->BindToClient(&output_surface_client)); |
47 | 47 |
48 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 48 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
49 new TestSharedBitmapManager()); | 49 new TestSharedBitmapManager()); |
50 scoped_ptr<ResourceProvider> resource_provider( | 50 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
51 ResourceProvider::Create(output_surface.get(), | 51 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, |
52 shared_bitmap_manager.get(), | 52 false, 1)); |
53 NULL, | |
54 NULL, | |
55 0, | |
56 false, | |
57 1)); | |
58 scoped_ptr<ScopedResource> texture = | 53 scoped_ptr<ScopedResource> texture = |
59 ScopedResource::Create(resource_provider.get()); | 54 ScopedResource::Create(resource_provider.get()); |
60 texture->Allocate( | 55 texture->Allocate( |
61 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); | 56 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); |
62 | 57 |
63 // The texture has an allocated byte-size now. | 58 // The texture has an allocated byte-size now. |
64 size_t expected_bytes = 30 * 30 * 4; | 59 size_t expected_bytes = 30 * 30 * 4; |
65 EXPECT_EQ(expected_bytes, texture->bytes()); | 60 EXPECT_EQ(expected_bytes, texture->bytes()); |
66 | 61 |
67 EXPECT_LT(0u, texture->id()); | 62 EXPECT_LT(0u, texture->id()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); | 99 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); |
105 EXPECT_LT(0u, texture->id()); | 100 EXPECT_LT(0u, texture->id()); |
106 EXPECT_EQ(1u, resource_provider->num_resources()); | 101 EXPECT_EQ(1u, resource_provider->num_resources()); |
107 texture->Free(); | 102 texture->Free(); |
108 EXPECT_EQ(0u, resource_provider->num_resources()); | 103 EXPECT_EQ(0u, resource_provider->num_resources()); |
109 } | 104 } |
110 } | 105 } |
111 | 106 |
112 } // namespace | 107 } // namespace |
113 } // namespace cc | 108 } // namespace cc |
OLD | NEW |