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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 scoped_ptr<ResourceProvider> resource_provider( | 50 scoped_ptr<ResourceProvider> resource_provider( |
51 ResourceProvider::Create(output_surface.get(), | 51 ResourceProvider::Create(output_surface.get(), |
52 shared_bitmap_manager.get(), | 52 shared_bitmap_manager.get(), |
53 NULL, | 53 NULL, |
54 NULL, | 54 NULL, |
55 0, | 55 0, |
56 false, | 56 false, |
57 1)); | 57 1)); |
58 scoped_ptr<ScopedResource> texture = | 58 scoped_ptr<ScopedResource> texture = |
59 ScopedResource::Create(resource_provider.get()); | 59 ScopedResource::Create(resource_provider.get()); |
60 texture->Allocate(gfx::Size(30, 30), ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 60 texture->Allocate( |
61 RGBA_8888); | 61 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); |
62 | 62 |
63 // The texture has an allocated byte-size now. | 63 // The texture has an allocated byte-size now. |
64 size_t expected_bytes = 30 * 30 * 4; | 64 size_t expected_bytes = 30 * 30 * 4; |
65 EXPECT_EQ(expected_bytes, texture->bytes()); | 65 EXPECT_EQ(expected_bytes, texture->bytes()); |
66 | 66 |
67 EXPECT_LT(0u, texture->id()); | 67 EXPECT_LT(0u, texture->id()); |
68 EXPECT_EQ(static_cast<unsigned>(RGBA_8888), texture->format()); | 68 EXPECT_EQ(static_cast<unsigned>(RGBA_8888), texture->format()); |
69 EXPECT_EQ(gfx::Size(30, 30), texture->size()); | 69 EXPECT_EQ(gfx::Size(30, 30), texture->size()); |
70 } | 70 } |
71 | 71 |
(...skipping 10 matching lines...) Expand all Loading... |
82 NULL, | 82 NULL, |
83 NULL, | 83 NULL, |
84 0, | 84 0, |
85 false, | 85 false, |
86 1)); | 86 1)); |
87 { | 87 { |
88 scoped_ptr<ScopedResource> texture = | 88 scoped_ptr<ScopedResource> texture = |
89 ScopedResource::Create(resource_provider.get()); | 89 ScopedResource::Create(resource_provider.get()); |
90 | 90 |
91 EXPECT_EQ(0u, resource_provider->num_resources()); | 91 EXPECT_EQ(0u, resource_provider->num_resources()); |
92 texture->Allocate(gfx::Size(30, 30), | 92 texture->Allocate( |
93 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); | 93 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); |
94 EXPECT_LT(0u, texture->id()); | 94 EXPECT_LT(0u, texture->id()); |
95 EXPECT_EQ(1u, resource_provider->num_resources()); | 95 EXPECT_EQ(1u, resource_provider->num_resources()); |
96 } | 96 } |
97 | 97 |
98 EXPECT_EQ(0u, resource_provider->num_resources()); | 98 EXPECT_EQ(0u, resource_provider->num_resources()); |
99 { | 99 { |
100 scoped_ptr<ScopedResource> texture = | 100 scoped_ptr<ScopedResource> texture = |
101 ScopedResource::Create(resource_provider.get()); | 101 ScopedResource::Create(resource_provider.get()); |
102 EXPECT_EQ(0u, resource_provider->num_resources()); | 102 EXPECT_EQ(0u, resource_provider->num_resources()); |
103 texture->Allocate(gfx::Size(30, 30), | 103 texture->Allocate( |
104 ResourceProvider::TEXTURE_HINT_IMMUTABLE, RGBA_8888); | 104 gfx::Size(30, 30), ResourceProvider::TextureHintImmutable, RGBA_8888); |
105 EXPECT_LT(0u, texture->id()); | 105 EXPECT_LT(0u, texture->id()); |
106 EXPECT_EQ(1u, resource_provider->num_resources()); | 106 EXPECT_EQ(1u, resource_provider->num_resources()); |
107 texture->Free(); | 107 texture->Free(); |
108 EXPECT_EQ(0u, resource_provider->num_resources()); | 108 EXPECT_EQ(0u, resource_provider->num_resources()); |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 } // namespace | 112 } // namespace |
113 } // namespace cc | 113 } // namespace cc |
OLD | NEW |