Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 608503005: Revert of cc: Remove use of PassAs() and constructor-casting with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/task_graph_runner_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/resource_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 context3d_(NULL), 382 context3d_(NULL),
383 child_context_(NULL), 383 child_context_(NULL),
384 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) { 384 main_thread_task_runner_(BlockingTaskRunner::Create(NULL)) {
385 switch (GetParam()) { 385 switch (GetParam()) {
386 case ResourceProvider::GLTexture: { 386 case ResourceProvider::GLTexture: {
387 scoped_ptr<ResourceProviderContext> context3d( 387 scoped_ptr<ResourceProviderContext> context3d(
388 ResourceProviderContext::Create(shared_data_.get())); 388 ResourceProviderContext::Create(shared_data_.get()));
389 context3d_ = context3d.get(); 389 context3d_ = context3d.get();
390 390
391 scoped_refptr<TestContextProvider> context_provider = 391 scoped_refptr<TestContextProvider> context_provider =
392 TestContextProvider::Create(context3d.Pass()); 392 TestContextProvider::Create(
393 context3d.PassAs<TestWebGraphicsContext3D>());
393 394
394 output_surface_ = FakeOutputSurface::Create3d(context_provider); 395 output_surface_ = FakeOutputSurface::Create3d(context_provider);
395 396
396 scoped_ptr<ResourceProviderContext> child_context_owned = 397 scoped_ptr<ResourceProviderContext> child_context_owned =
397 ResourceProviderContext::Create(shared_data_.get()); 398 ResourceProviderContext::Create(shared_data_.get());
398 child_context_ = child_context_owned.get(); 399 child_context_ = child_context_owned.get();
399 child_output_surface_ = 400 child_output_surface_ = FakeOutputSurface::Create3d(
400 FakeOutputSurface::Create3d(child_context_owned.Pass()); 401 child_context_owned.PassAs<TestWebGraphicsContext3D>());
401 break; 402 break;
402 } 403 }
403 case ResourceProvider::Bitmap: 404 case ResourceProvider::Bitmap:
404 output_surface_ = FakeOutputSurface::CreateSoftware( 405 output_surface_ = FakeOutputSurface::CreateSoftware(
405 make_scoped_ptr(new SoftwareOutputDevice)); 406 make_scoped_ptr(new SoftwareOutputDevice));
406 child_output_surface_ = FakeOutputSurface::CreateSoftware( 407 child_output_surface_ = FakeOutputSurface::CreateSoftware(
407 make_scoped_ptr(new SoftwareOutputDevice)); 408 make_scoped_ptr(new SoftwareOutputDevice));
408 break; 409 break;
409 case ResourceProvider::InvalidType: 410 case ResourceProvider::InvalidType:
410 NOTREACHED(); 411 NOTREACHED();
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 } 1146 }
1146 1147
1147 TEST_P(ResourceProviderTest, TransferGLToSoftware) { 1148 TEST_P(ResourceProviderTest, TransferGLToSoftware) {
1148 if (GetParam() != ResourceProvider::Bitmap) 1149 if (GetParam() != ResourceProvider::Bitmap)
1149 return; 1150 return;
1150 1151
1151 scoped_ptr<ResourceProviderContext> child_context_owned( 1152 scoped_ptr<ResourceProviderContext> child_context_owned(
1152 ResourceProviderContext::Create(shared_data_.get())); 1153 ResourceProviderContext::Create(shared_data_.get()));
1153 1154
1154 FakeOutputSurfaceClient child_output_surface_client; 1155 FakeOutputSurfaceClient child_output_surface_client;
1155 scoped_ptr<OutputSurface> child_output_surface( 1156 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d(
1156 FakeOutputSurface::Create3d(child_context_owned.Pass())); 1157 child_context_owned.PassAs<TestWebGraphicsContext3D>()));
1157 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); 1158 CHECK(child_output_surface->BindToClient(&child_output_surface_client));
1158 1159
1159 scoped_ptr<ResourceProvider> child_resource_provider( 1160 scoped_ptr<ResourceProvider> child_resource_provider(
1160 ResourceProvider::Create(child_output_surface.get(), 1161 ResourceProvider::Create(child_output_surface.get(),
1161 shared_bitmap_manager_.get(), 1162 shared_bitmap_manager_.get(),
1162 NULL, 1163 NULL,
1163 0, 1164 0,
1164 false, 1165 false,
1165 1, 1166 1,
1166 false)); 1167 false));
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 EXPECT_EQ(1u, resource_provider_->num_resources()); 1449 EXPECT_EQ(1u, resource_provider_->num_resources());
1449 ASSERT_EQ(1u, returned_to_child.size()); 1450 ASSERT_EQ(1u, returned_to_child.size());
1450 if (GetParam() == ResourceProvider::GLTexture) { 1451 if (GetParam() == ResourceProvider::GLTexture) {
1451 EXPECT_NE(0u, returned_to_child[0].sync_point); 1452 EXPECT_NE(0u, returned_to_child[0].sync_point);
1452 } 1453 }
1453 EXPECT_FALSE(returned_to_child[0].lost); 1454 EXPECT_FALSE(returned_to_child[0].lost);
1454 returned_to_child.clear(); 1455 returned_to_child.clear();
1455 1456
1456 // Destroy the parent resource provider. The resource that's left should be 1457 // Destroy the parent resource provider. The resource that's left should be
1457 // lost at this point, and returned. 1458 // lost at this point, and returned.
1458 resource_provider_ = nullptr; 1459 resource_provider_.reset();
1459 ASSERT_EQ(1u, returned_to_child.size()); 1460 ASSERT_EQ(1u, returned_to_child.size());
1460 if (GetParam() == ResourceProvider::GLTexture) { 1461 if (GetParam() == ResourceProvider::GLTexture) {
1461 EXPECT_NE(0u, returned_to_child[0].sync_point); 1462 EXPECT_NE(0u, returned_to_child[0].sync_point);
1462 } 1463 }
1463 EXPECT_TRUE(returned_to_child[0].lost); 1464 EXPECT_TRUE(returned_to_child[0].lost);
1464 } 1465 }
1465 } 1466 }
1466 1467
1467 TEST_P(ResourceProviderTest, DeleteTransferredResources) { 1468 TEST_P(ResourceProviderTest, DeleteTransferredResources) {
1468 gfx::Size size(1, 1); 1469 gfx::Size size(1, 1);
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 } 1626 }
1626 1627
1627 class ResourceProviderTestTextureFilters : public ResourceProviderTest { 1628 class ResourceProviderTestTextureFilters : public ResourceProviderTest {
1628 public: 1629 public:
1629 static void RunTest(GLenum child_filter, GLenum parent_filter) { 1630 static void RunTest(GLenum child_filter, GLenum parent_filter) {
1630 scoped_ptr<TextureStateTrackingContext> child_context_owned( 1631 scoped_ptr<TextureStateTrackingContext> child_context_owned(
1631 new TextureStateTrackingContext); 1632 new TextureStateTrackingContext);
1632 TextureStateTrackingContext* child_context = child_context_owned.get(); 1633 TextureStateTrackingContext* child_context = child_context_owned.get();
1633 1634
1634 FakeOutputSurfaceClient child_output_surface_client; 1635 FakeOutputSurfaceClient child_output_surface_client;
1635 scoped_ptr<OutputSurface> child_output_surface( 1636 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d(
1636 FakeOutputSurface::Create3d(child_context_owned.Pass())); 1637 child_context_owned.PassAs<TestWebGraphicsContext3D>()));
1637 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); 1638 CHECK(child_output_surface->BindToClient(&child_output_surface_client));
1638 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 1639 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
1639 new TestSharedBitmapManager()); 1640 new TestSharedBitmapManager());
1640 1641
1641 scoped_ptr<ResourceProvider> child_resource_provider( 1642 scoped_ptr<ResourceProvider> child_resource_provider(
1642 ResourceProvider::Create(child_output_surface.get(), 1643 ResourceProvider::Create(child_output_surface.get(),
1643 shared_bitmap_manager.get(), 1644 shared_bitmap_manager.get(),
1644 NULL, 1645 NULL,
1645 0, 1646 0,
1646 false, 1647 false,
1647 1, 1648 1,
1648 false)); 1649 false));
1649 1650
1650 scoped_ptr<TextureStateTrackingContext> parent_context_owned( 1651 scoped_ptr<TextureStateTrackingContext> parent_context_owned(
1651 new TextureStateTrackingContext); 1652 new TextureStateTrackingContext);
1652 TextureStateTrackingContext* parent_context = parent_context_owned.get(); 1653 TextureStateTrackingContext* parent_context = parent_context_owned.get();
1653 1654
1654 FakeOutputSurfaceClient parent_output_surface_client; 1655 FakeOutputSurfaceClient parent_output_surface_client;
1655 scoped_ptr<OutputSurface> parent_output_surface( 1656 scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d(
1656 FakeOutputSurface::Create3d(parent_context_owned.Pass())); 1657 parent_context_owned.PassAs<TestWebGraphicsContext3D>()));
1657 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); 1658 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client));
1658 1659
1659 scoped_ptr<ResourceProvider> parent_resource_provider( 1660 scoped_ptr<ResourceProvider> parent_resource_provider(
1660 ResourceProvider::Create(parent_output_surface.get(), 1661 ResourceProvider::Create(parent_output_surface.get(),
1661 shared_bitmap_manager.get(), 1662 shared_bitmap_manager.get(),
1662 NULL, 1663 NULL,
1663 0, 1664 0,
1664 false, 1665 false,
1665 1, 1666 1,
1666 false)); 1667 false));
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 uint32 release_sync_point = 0; 2198 uint32 release_sync_point = 0;
2198 bool lost_resource = false; 2199 bool lost_resource = false;
2199 bool release_called = false; 2200 bool release_called = false;
2200 uint32 sync_point = 0; 2201 uint32 sync_point = 0;
2201 CreateChildMailbox( 2202 CreateChildMailbox(
2202 &release_sync_point, &lost_resource, &release_called, &sync_point); 2203 &release_sync_point, &lost_resource, &release_called, &sync_point);
2203 2204
2204 EXPECT_EQ(0u, release_sync_point); 2205 EXPECT_EQ(0u, release_sync_point);
2205 EXPECT_FALSE(lost_resource); 2206 EXPECT_FALSE(lost_resource);
2206 2207
2207 child_resource_provider_ = nullptr; 2208 child_resource_provider_.reset();
2208 2209
2209 if (GetParam() == ResourceProvider::GLTexture) { 2210 if (GetParam() == ResourceProvider::GLTexture) {
2210 EXPECT_LE(sync_point, release_sync_point); 2211 EXPECT_LE(sync_point, release_sync_point);
2211 } 2212 }
2212 EXPECT_TRUE(release_called); 2213 EXPECT_TRUE(release_called);
2213 EXPECT_FALSE(lost_resource); 2214 EXPECT_FALSE(lost_resource);
2214 } 2215 }
2215 2216
2216 TEST_P(ResourceProviderTest, ShutdownWithExportedResource) { 2217 TEST_P(ResourceProviderTest, ShutdownWithExportedResource) {
2217 uint32 release_sync_point = 0; 2218 uint32 release_sync_point = 0;
2218 bool lost_resource = false; 2219 bool lost_resource = false;
2219 bool release_called = false; 2220 bool release_called = false;
2220 uint32 sync_point = 0; 2221 uint32 sync_point = 0;
2221 ResourceProvider::ResourceId resource = CreateChildMailbox( 2222 ResourceProvider::ResourceId resource = CreateChildMailbox(
2222 &release_sync_point, &lost_resource, &release_called, &sync_point); 2223 &release_sync_point, &lost_resource, &release_called, &sync_point);
2223 2224
2224 // Transfer the resource, so we can't release it properly on shutdown. 2225 // Transfer the resource, so we can't release it properly on shutdown.
2225 ResourceProvider::ResourceIdArray resource_ids_to_transfer; 2226 ResourceProvider::ResourceIdArray resource_ids_to_transfer;
2226 resource_ids_to_transfer.push_back(resource); 2227 resource_ids_to_transfer.push_back(resource);
2227 TransferableResourceArray list; 2228 TransferableResourceArray list;
2228 child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer, 2229 child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer,
2229 &list); 2230 &list);
2230 2231
2231 EXPECT_EQ(0u, release_sync_point); 2232 EXPECT_EQ(0u, release_sync_point);
2232 EXPECT_FALSE(lost_resource); 2233 EXPECT_FALSE(lost_resource);
2233 2234
2234 child_resource_provider_ = nullptr; 2235 child_resource_provider_.reset();
2235 2236
2236 // Since the resource is in the parent, the child considers it lost. 2237 // Since the resource is in the parent, the child considers it lost.
2237 EXPECT_EQ(0u, release_sync_point); 2238 EXPECT_EQ(0u, release_sync_point);
2238 EXPECT_TRUE(lost_resource); 2239 EXPECT_TRUE(lost_resource);
2239 } 2240 }
2240 2241
2241 TEST_P(ResourceProviderTest, LostContext) { 2242 TEST_P(ResourceProviderTest, LostContext) {
2242 // TextureMailbox callbacks only exist for GL textures for now. 2243 // TextureMailbox callbacks only exist for GL textures for now.
2243 if (GetParam() != ResourceProvider::GLTexture) 2244 if (GetParam() != ResourceProvider::GLTexture)
2244 return; 2245 return;
(...skipping 15 matching lines...) Expand all
2260 &lost_resource, 2261 &lost_resource,
2261 &main_thread_task_runner)); 2262 &main_thread_task_runner));
2262 resource_provider_->CreateResourceFromTextureMailbox( 2263 resource_provider_->CreateResourceFromTextureMailbox(
2263 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass()); 2264 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass());
2264 2265
2265 EXPECT_EQ(0u, release_sync_point); 2266 EXPECT_EQ(0u, release_sync_point);
2266 EXPECT_FALSE(lost_resource); 2267 EXPECT_FALSE(lost_resource);
2267 EXPECT_EQ(NULL, main_thread_task_runner); 2268 EXPECT_EQ(NULL, main_thread_task_runner);
2268 2269
2269 resource_provider_->DidLoseOutputSurface(); 2270 resource_provider_->DidLoseOutputSurface();
2270 resource_provider_ = nullptr; 2271 resource_provider_.reset();
2271 2272
2272 EXPECT_LE(sync_point, release_sync_point); 2273 EXPECT_LE(sync_point, release_sync_point);
2273 EXPECT_TRUE(lost_resource); 2274 EXPECT_TRUE(lost_resource);
2274 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); 2275 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner);
2275 } 2276 }
2276 2277
2277 TEST_P(ResourceProviderTest, ScopedSampler) { 2278 TEST_P(ResourceProviderTest, ScopedSampler) {
2278 // Sampling is only supported for GL textures. 2279 // Sampling is only supported for GL textures.
2279 if (GetParam() != ResourceProvider::GLTexture) 2280 if (GetParam() != ResourceProvider::GLTexture)
2280 return; 2281 return;
2281 2282
2282 scoped_ptr<TextureStateTrackingContext> context_owned( 2283 scoped_ptr<TextureStateTrackingContext> context_owned(
2283 new TextureStateTrackingContext); 2284 new TextureStateTrackingContext);
2284 TextureStateTrackingContext* context = context_owned.get(); 2285 TextureStateTrackingContext* context = context_owned.get();
2285 2286
2286 FakeOutputSurfaceClient output_surface_client; 2287 FakeOutputSurfaceClient output_surface_client;
2287 scoped_ptr<OutputSurface> output_surface( 2288 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2288 FakeOutputSurface::Create3d(context_owned.Pass())); 2289 context_owned.PassAs<TestWebGraphicsContext3D>()));
2289 CHECK(output_surface->BindToClient(&output_surface_client)); 2290 CHECK(output_surface->BindToClient(&output_surface_client));
2290 2291
2291 scoped_ptr<ResourceProvider> resource_provider( 2292 scoped_ptr<ResourceProvider> resource_provider(
2292 ResourceProvider::Create(output_surface.get(), 2293 ResourceProvider::Create(output_surface.get(),
2293 shared_bitmap_manager_.get(), 2294 shared_bitmap_manager_.get(),
2294 NULL, 2295 NULL,
2295 0, 2296 0,
2296 false, 2297 false,
2297 1, 2298 1,
2298 false)); 2299 false));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2364 TEST_P(ResourceProviderTest, ManagedResource) { 2365 TEST_P(ResourceProviderTest, ManagedResource) {
2365 // Sampling is only supported for GL textures. 2366 // Sampling is only supported for GL textures.
2366 if (GetParam() != ResourceProvider::GLTexture) 2367 if (GetParam() != ResourceProvider::GLTexture)
2367 return; 2368 return;
2368 2369
2369 scoped_ptr<TextureStateTrackingContext> context_owned( 2370 scoped_ptr<TextureStateTrackingContext> context_owned(
2370 new TextureStateTrackingContext); 2371 new TextureStateTrackingContext);
2371 TextureStateTrackingContext* context = context_owned.get(); 2372 TextureStateTrackingContext* context = context_owned.get();
2372 2373
2373 FakeOutputSurfaceClient output_surface_client; 2374 FakeOutputSurfaceClient output_surface_client;
2374 scoped_ptr<OutputSurface> output_surface( 2375 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2375 FakeOutputSurface::Create3d(context_owned.Pass())); 2376 context_owned.PassAs<TestWebGraphicsContext3D>()));
2376 CHECK(output_surface->BindToClient(&output_surface_client)); 2377 CHECK(output_surface->BindToClient(&output_surface_client));
2377 2378
2378 scoped_ptr<ResourceProvider> resource_provider( 2379 scoped_ptr<ResourceProvider> resource_provider(
2379 ResourceProvider::Create(output_surface.get(), 2380 ResourceProvider::Create(output_surface.get(),
2380 shared_bitmap_manager_.get(), 2381 shared_bitmap_manager_.get(),
2381 NULL, 2382 NULL,
2382 0, 2383 0,
2383 false, 2384 false,
2384 1, 2385 1,
2385 false)); 2386 false));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 TEST_P(ResourceProviderTest, TextureWrapMode) { 2420 TEST_P(ResourceProviderTest, TextureWrapMode) {
2420 // Sampling is only supported for GL textures. 2421 // Sampling is only supported for GL textures.
2421 if (GetParam() != ResourceProvider::GLTexture) 2422 if (GetParam() != ResourceProvider::GLTexture)
2422 return; 2423 return;
2423 2424
2424 scoped_ptr<TextureStateTrackingContext> context_owned( 2425 scoped_ptr<TextureStateTrackingContext> context_owned(
2425 new TextureStateTrackingContext); 2426 new TextureStateTrackingContext);
2426 TextureStateTrackingContext* context = context_owned.get(); 2427 TextureStateTrackingContext* context = context_owned.get();
2427 2428
2428 FakeOutputSurfaceClient output_surface_client; 2429 FakeOutputSurfaceClient output_surface_client;
2429 scoped_ptr<OutputSurface> output_surface( 2430 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2430 FakeOutputSurface::Create3d(context_owned.Pass())); 2431 context_owned.PassAs<TestWebGraphicsContext3D>()));
2431 CHECK(output_surface->BindToClient(&output_surface_client)); 2432 CHECK(output_surface->BindToClient(&output_surface_client));
2432 2433
2433 scoped_ptr<ResourceProvider> resource_provider( 2434 scoped_ptr<ResourceProvider> resource_provider(
2434 ResourceProvider::Create(output_surface.get(), 2435 ResourceProvider::Create(output_surface.get(),
2435 shared_bitmap_manager_.get(), 2436 shared_bitmap_manager_.get(),
2436 NULL, 2437 NULL,
2437 0, 2438 0,
2438 false, 2439 false,
2439 1, 2440 1,
2440 false)); 2441 false));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 if (GetParam() != ResourceProvider::GLTexture) 2479 if (GetParam() != ResourceProvider::GLTexture)
2479 return; 2480 return;
2480 2481
2481 scoped_ptr<TextureStateTrackingContext> context_owned( 2482 scoped_ptr<TextureStateTrackingContext> context_owned(
2482 new TextureStateTrackingContext); 2483 new TextureStateTrackingContext);
2483 TextureStateTrackingContext* context = context_owned.get(); 2484 TextureStateTrackingContext* context = context_owned.get();
2484 context->set_support_texture_storage(true); 2485 context->set_support_texture_storage(true);
2485 context->set_support_texture_usage(true); 2486 context->set_support_texture_usage(true);
2486 2487
2487 FakeOutputSurfaceClient output_surface_client; 2488 FakeOutputSurfaceClient output_surface_client;
2488 scoped_ptr<OutputSurface> output_surface( 2489 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2489 FakeOutputSurface::Create3d(context_owned.Pass())); 2490 context_owned.PassAs<TestWebGraphicsContext3D>()));
2490 CHECK(output_surface->BindToClient(&output_surface_client)); 2491 CHECK(output_surface->BindToClient(&output_surface_client));
2491 2492
2492 scoped_ptr<ResourceProvider> resource_provider( 2493 scoped_ptr<ResourceProvider> resource_provider(
2493 ResourceProvider::Create(output_surface.get(), 2494 ResourceProvider::Create(output_surface.get(),
2494 shared_bitmap_manager_.get(), 2495 shared_bitmap_manager_.get(),
2495 NULL, 2496 NULL,
2496 0, 2497 0,
2497 false, 2498 false,
2498 1, 2499 1,
2499 false)); 2500 false));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2603 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) { 2604 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) {
2604 // Mailboxing is only supported for GL textures. 2605 // Mailboxing is only supported for GL textures.
2605 if (GetParam() != ResourceProvider::GLTexture) 2606 if (GetParam() != ResourceProvider::GLTexture)
2606 return; 2607 return;
2607 2608
2608 scoped_ptr<TextureStateTrackingContext> context_owned( 2609 scoped_ptr<TextureStateTrackingContext> context_owned(
2609 new TextureStateTrackingContext); 2610 new TextureStateTrackingContext);
2610 TextureStateTrackingContext* context = context_owned.get(); 2611 TextureStateTrackingContext* context = context_owned.get();
2611 2612
2612 FakeOutputSurfaceClient output_surface_client; 2613 FakeOutputSurfaceClient output_surface_client;
2613 scoped_ptr<OutputSurface> output_surface( 2614 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2614 FakeOutputSurface::Create3d(context_owned.Pass())); 2615 context_owned.PassAs<TestWebGraphicsContext3D>()));
2615 CHECK(output_surface->BindToClient(&output_surface_client)); 2616 CHECK(output_surface->BindToClient(&output_surface_client));
2616 2617
2617 scoped_ptr<ResourceProvider> resource_provider( 2618 scoped_ptr<ResourceProvider> resource_provider(
2618 ResourceProvider::Create(output_surface.get(), 2619 ResourceProvider::Create(output_surface.get(),
2619 shared_bitmap_manager_.get(), 2620 shared_bitmap_manager_.get(),
2620 main_thread_task_runner_.get(), 2621 main_thread_task_runner_.get(),
2621 0, 2622 0,
2622 false, 2623 false,
2623 1, 2624 1,
2624 false)); 2625 false));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
2688 TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { 2689 TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) {
2689 // Mailboxing is only supported for GL textures. 2690 // Mailboxing is only supported for GL textures.
2690 if (GetParam() != ResourceProvider::GLTexture) 2691 if (GetParam() != ResourceProvider::GLTexture)
2691 return; 2692 return;
2692 2693
2693 scoped_ptr<TextureStateTrackingContext> context_owned( 2694 scoped_ptr<TextureStateTrackingContext> context_owned(
2694 new TextureStateTrackingContext); 2695 new TextureStateTrackingContext);
2695 TextureStateTrackingContext* context = context_owned.get(); 2696 TextureStateTrackingContext* context = context_owned.get();
2696 2697
2697 FakeOutputSurfaceClient output_surface_client; 2698 FakeOutputSurfaceClient output_surface_client;
2698 scoped_ptr<OutputSurface> output_surface( 2699 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2699 FakeOutputSurface::Create3d(context_owned.Pass())); 2700 context_owned.PassAs<TestWebGraphicsContext3D>()));
2700 CHECK(output_surface->BindToClient(&output_surface_client)); 2701 CHECK(output_surface->BindToClient(&output_surface_client));
2701 2702
2702 scoped_ptr<ResourceProvider> resource_provider( 2703 scoped_ptr<ResourceProvider> resource_provider(
2703 ResourceProvider::Create(output_surface.get(), 2704 ResourceProvider::Create(output_surface.get(),
2704 shared_bitmap_manager_.get(), 2705 shared_bitmap_manager_.get(),
2705 NULL, 2706 NULL,
2706 0, 2707 0,
2707 false, 2708 false,
2708 1, 2709 1,
2709 false)); 2710 false));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) { 2764 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) {
2764 // Mailboxing is only supported for GL textures. 2765 // Mailboxing is only supported for GL textures.
2765 if (GetParam() != ResourceProvider::GLTexture) 2766 if (GetParam() != ResourceProvider::GLTexture)
2766 return; 2767 return;
2767 2768
2768 scoped_ptr<TextureStateTrackingContext> context_owned( 2769 scoped_ptr<TextureStateTrackingContext> context_owned(
2769 new TextureStateTrackingContext); 2770 new TextureStateTrackingContext);
2770 TextureStateTrackingContext* context = context_owned.get(); 2771 TextureStateTrackingContext* context = context_owned.get();
2771 2772
2772 FakeOutputSurfaceClient output_surface_client; 2773 FakeOutputSurfaceClient output_surface_client;
2773 scoped_ptr<OutputSurface> output_surface( 2774 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2774 FakeOutputSurface::Create3d(context_owned.Pass())); 2775 context_owned.PassAs<TestWebGraphicsContext3D>()));
2775 CHECK(output_surface->BindToClient(&output_surface_client)); 2776 CHECK(output_surface->BindToClient(&output_surface_client));
2776 2777
2777 scoped_ptr<ResourceProvider> resource_provider( 2778 scoped_ptr<ResourceProvider> resource_provider(
2778 ResourceProvider::Create(output_surface.get(), 2779 ResourceProvider::Create(output_surface.get(),
2779 shared_bitmap_manager_.get(), 2780 shared_bitmap_manager_.get(),
2780 NULL, 2781 NULL,
2781 0, 2782 0,
2782 false, 2783 false,
2783 1, 2784 1,
2784 false)); 2785 false));
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) { 2823 TEST_P(ResourceProviderTest, TextureMailbox_WaitSyncPointIfNeeded_NoSyncPoint) {
2823 // Mailboxing is only supported for GL textures. 2824 // Mailboxing is only supported for GL textures.
2824 if (GetParam() != ResourceProvider::GLTexture) 2825 if (GetParam() != ResourceProvider::GLTexture)
2825 return; 2826 return;
2826 2827
2827 scoped_ptr<TextureStateTrackingContext> context_owned( 2828 scoped_ptr<TextureStateTrackingContext> context_owned(
2828 new TextureStateTrackingContext); 2829 new TextureStateTrackingContext);
2829 TextureStateTrackingContext* context = context_owned.get(); 2830 TextureStateTrackingContext* context = context_owned.get();
2830 2831
2831 FakeOutputSurfaceClient output_surface_client; 2832 FakeOutputSurfaceClient output_surface_client;
2832 scoped_ptr<OutputSurface> output_surface( 2833 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2833 FakeOutputSurface::Create3d(context_owned.Pass())); 2834 context_owned.PassAs<TestWebGraphicsContext3D>()));
2834 CHECK(output_surface->BindToClient(&output_surface_client)); 2835 CHECK(output_surface->BindToClient(&output_surface_client));
2835 2836
2836 scoped_ptr<ResourceProvider> resource_provider( 2837 scoped_ptr<ResourceProvider> resource_provider(
2837 ResourceProvider::Create(output_surface.get(), 2838 ResourceProvider::Create(output_surface.get(),
2838 shared_bitmap_manager_.get(), 2839 shared_bitmap_manager_.get(),
2839 NULL, 2840 NULL,
2840 0, 2841 0,
2841 false, 2842 false,
2842 1, 2843 1,
2843 false)); 2844 false));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 2951
2951 TEST_P(ResourceProviderTest, TextureAllocation) { 2952 TEST_P(ResourceProviderTest, TextureAllocation) {
2952 // Only for GL textures. 2953 // Only for GL textures.
2953 if (GetParam() != ResourceProvider::GLTexture) 2954 if (GetParam() != ResourceProvider::GLTexture)
2954 return; 2955 return;
2955 scoped_ptr<AllocationTrackingContext3D> context_owned( 2956 scoped_ptr<AllocationTrackingContext3D> context_owned(
2956 new StrictMock<AllocationTrackingContext3D>); 2957 new StrictMock<AllocationTrackingContext3D>);
2957 AllocationTrackingContext3D* context = context_owned.get(); 2958 AllocationTrackingContext3D* context = context_owned.get();
2958 2959
2959 FakeOutputSurfaceClient output_surface_client; 2960 FakeOutputSurfaceClient output_surface_client;
2960 scoped_ptr<OutputSurface> output_surface( 2961 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
2961 FakeOutputSurface::Create3d(context_owned.Pass())); 2962 context_owned.PassAs<TestWebGraphicsContext3D>()));
2962 CHECK(output_surface->BindToClient(&output_surface_client)); 2963 CHECK(output_surface->BindToClient(&output_surface_client));
2963 2964
2964 scoped_ptr<ResourceProvider> resource_provider( 2965 scoped_ptr<ResourceProvider> resource_provider(
2965 ResourceProvider::Create(output_surface.get(), 2966 ResourceProvider::Create(output_surface.get(),
2966 shared_bitmap_manager_.get(), 2967 shared_bitmap_manager_.get(),
2967 NULL, 2968 NULL,
2968 0, 2969 0,
2969 false, 2970 false,
2970 1, 2971 1,
2971 false)); 2972 false));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 // Only for GL textures. 3031 // Only for GL textures.
3031 if (GetParam() != ResourceProvider::GLTexture) 3032 if (GetParam() != ResourceProvider::GLTexture)
3032 return; 3033 return;
3033 scoped_ptr<AllocationTrackingContext3D> context_owned( 3034 scoped_ptr<AllocationTrackingContext3D> context_owned(
3034 new StrictMock<AllocationTrackingContext3D>); 3035 new StrictMock<AllocationTrackingContext3D>);
3035 AllocationTrackingContext3D* context = context_owned.get(); 3036 AllocationTrackingContext3D* context = context_owned.get();
3036 context->set_support_texture_storage(true); 3037 context->set_support_texture_storage(true);
3037 context->set_support_texture_usage(true); 3038 context->set_support_texture_usage(true);
3038 3039
3039 FakeOutputSurfaceClient output_surface_client; 3040 FakeOutputSurfaceClient output_surface_client;
3040 scoped_ptr<OutputSurface> output_surface( 3041 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3041 FakeOutputSurface::Create3d(context_owned.Pass())); 3042 context_owned.PassAs<TestWebGraphicsContext3D>()));
3042 CHECK(output_surface->BindToClient(&output_surface_client)); 3043 CHECK(output_surface->BindToClient(&output_surface_client));
3043 3044
3044 scoped_ptr<ResourceProvider> resource_provider( 3045 scoped_ptr<ResourceProvider> resource_provider(
3045 ResourceProvider::Create(output_surface.get(), 3046 ResourceProvider::Create(output_surface.get(),
3046 shared_bitmap_manager_.get(), 3047 shared_bitmap_manager_.get(),
3047 NULL, 3048 NULL,
3048 0, 3049 0,
3049 false, 3050 false,
3050 1, 3051 1,
3051 false)); 3052 false));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 if (GetParam() != ResourceProvider::GLTexture) 3091 if (GetParam() != ResourceProvider::GLTexture)
3091 return; 3092 return;
3092 scoped_ptr<AllocationTrackingContext3D> context_owned( 3093 scoped_ptr<AllocationTrackingContext3D> context_owned(
3093 new StrictMock<AllocationTrackingContext3D>); 3094 new StrictMock<AllocationTrackingContext3D>);
3094 AllocationTrackingContext3D* context = context_owned.get(); 3095 AllocationTrackingContext3D* context = context_owned.get();
3095 context->set_support_texture_format_bgra8888(true); 3096 context->set_support_texture_format_bgra8888(true);
3096 context->set_support_texture_storage(true); 3097 context->set_support_texture_storage(true);
3097 context->set_support_texture_usage(true); 3098 context->set_support_texture_usage(true);
3098 3099
3099 FakeOutputSurfaceClient output_surface_client; 3100 FakeOutputSurfaceClient output_surface_client;
3100 scoped_ptr<OutputSurface> output_surface( 3101 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3101 FakeOutputSurface::Create3d(context_owned.Pass())); 3102 context_owned.PassAs<TestWebGraphicsContext3D>()));
3102 CHECK(output_surface->BindToClient(&output_surface_client)); 3103 CHECK(output_surface->BindToClient(&output_surface_client));
3103 3104
3104 scoped_ptr<ResourceProvider> resource_provider( 3105 scoped_ptr<ResourceProvider> resource_provider(
3105 ResourceProvider::Create(output_surface.get(), 3106 ResourceProvider::Create(output_surface.get(),
3106 shared_bitmap_manager_.get(), 3107 shared_bitmap_manager_.get(),
3107 NULL, 3108 NULL,
3108 0, 3109 0,
3109 false, 3110 false,
3110 1, 3111 1,
3111 false)); 3112 false));
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 } 3145 }
3145 3146
3146 TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) { 3147 TEST_P(ResourceProviderTest, PixelBuffer_GLTexture) {
3147 if (GetParam() != ResourceProvider::GLTexture) 3148 if (GetParam() != ResourceProvider::GLTexture)
3148 return; 3149 return;
3149 scoped_ptr<AllocationTrackingContext3D> context_owned( 3150 scoped_ptr<AllocationTrackingContext3D> context_owned(
3150 new StrictMock<AllocationTrackingContext3D>); 3151 new StrictMock<AllocationTrackingContext3D>);
3151 AllocationTrackingContext3D* context = context_owned.get(); 3152 AllocationTrackingContext3D* context = context_owned.get();
3152 3153
3153 FakeOutputSurfaceClient output_surface_client; 3154 FakeOutputSurfaceClient output_surface_client;
3154 scoped_ptr<OutputSurface> output_surface( 3155 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3155 FakeOutputSurface::Create3d(context_owned.Pass())); 3156 context_owned.PassAs<TestWebGraphicsContext3D>()));
3156 CHECK(output_surface->BindToClient(&output_surface_client)); 3157 CHECK(output_surface->BindToClient(&output_surface_client));
3157 3158
3158 gfx::Size size(2, 2); 3159 gfx::Size size(2, 2);
3159 ResourceFormat format = RGBA_8888; 3160 ResourceFormat format = RGBA_8888;
3160 ResourceProvider::ResourceId id = 0; 3161 ResourceProvider::ResourceId id = 0;
3161 int texture_id = 123; 3162 int texture_id = 123;
3162 3163
3163 scoped_ptr<ResourceProvider> resource_provider( 3164 scoped_ptr<ResourceProvider> resource_provider(
3164 ResourceProvider::Create(output_surface.get(), 3165 ResourceProvider::Create(output_surface.get(),
3165 shared_bitmap_manager_.get(), 3166 shared_bitmap_manager_.get(),
(...skipping 25 matching lines...) Expand all
3191 3192
3192 TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) { 3193 TEST_P(ResourceProviderTest, ForcingAsyncUploadToComplete) {
3193 // Only for GL textures. 3194 // Only for GL textures.
3194 if (GetParam() != ResourceProvider::GLTexture) 3195 if (GetParam() != ResourceProvider::GLTexture)
3195 return; 3196 return;
3196 scoped_ptr<AllocationTrackingContext3D> context_owned( 3197 scoped_ptr<AllocationTrackingContext3D> context_owned(
3197 new StrictMock<AllocationTrackingContext3D>); 3198 new StrictMock<AllocationTrackingContext3D>);
3198 AllocationTrackingContext3D* context = context_owned.get(); 3199 AllocationTrackingContext3D* context = context_owned.get();
3199 3200
3200 FakeOutputSurfaceClient output_surface_client; 3201 FakeOutputSurfaceClient output_surface_client;
3201 scoped_ptr<OutputSurface> output_surface( 3202 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3202 FakeOutputSurface::Create3d(context_owned.Pass())); 3203 context_owned.PassAs<TestWebGraphicsContext3D>()));
3203 CHECK(output_surface->BindToClient(&output_surface_client)); 3204 CHECK(output_surface->BindToClient(&output_surface_client));
3204 3205
3205 gfx::Size size(2, 2); 3206 gfx::Size size(2, 2);
3206 ResourceFormat format = RGBA_8888; 3207 ResourceFormat format = RGBA_8888;
3207 ResourceProvider::ResourceId id = 0; 3208 ResourceProvider::ResourceId id = 0;
3208 int texture_id = 123; 3209 int texture_id = 123;
3209 3210
3210 scoped_ptr<ResourceProvider> resource_provider( 3211 scoped_ptr<ResourceProvider> resource_provider(
3211 ResourceProvider::Create(output_surface.get(), 3212 ResourceProvider::Create(output_surface.get(),
3212 shared_bitmap_manager_.get(), 3213 shared_bitmap_manager_.get(),
(...skipping 25 matching lines...) Expand all
3238 3239
3239 Mock::VerifyAndClearExpectations(context); 3240 Mock::VerifyAndClearExpectations(context);
3240 } 3241 }
3241 3242
3242 TEST_P(ResourceProviderTest, PixelBufferLostContext) { 3243 TEST_P(ResourceProviderTest, PixelBufferLostContext) {
3243 scoped_ptr<AllocationTrackingContext3D> context_owned( 3244 scoped_ptr<AllocationTrackingContext3D> context_owned(
3244 new NiceMock<AllocationTrackingContext3D>); 3245 new NiceMock<AllocationTrackingContext3D>);
3245 AllocationTrackingContext3D* context = context_owned.get(); 3246 AllocationTrackingContext3D* context = context_owned.get();
3246 3247
3247 FakeOutputSurfaceClient output_surface_client; 3248 FakeOutputSurfaceClient output_surface_client;
3248 scoped_ptr<OutputSurface> output_surface( 3249 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3249 FakeOutputSurface::Create3d(context_owned.Pass())); 3250 context_owned.PassAs<TestWebGraphicsContext3D>()));
3250 CHECK(output_surface->BindToClient(&output_surface_client)); 3251 CHECK(output_surface->BindToClient(&output_surface_client));
3251 3252
3252 gfx::Size size(2, 2); 3253 gfx::Size size(2, 2);
3253 ResourceFormat format = RGBA_8888; 3254 ResourceFormat format = RGBA_8888;
3254 ResourceProvider::ResourceId id = 0; 3255 ResourceProvider::ResourceId id = 0;
3255 int texture_id = 123; 3256 int texture_id = 123;
3256 3257
3257 scoped_ptr<ResourceProvider> resource_provider( 3258 scoped_ptr<ResourceProvider> resource_provider(
3258 ResourceProvider::Create(output_surface.get(), 3259 ResourceProvider::Create(output_surface.get(),
3259 shared_bitmap_manager_.get(), 3260 shared_bitmap_manager_.get(),
(...skipping 20 matching lines...) Expand all
3280 3281
3281 TEST_P(ResourceProviderTest, Image_GLTexture) { 3282 TEST_P(ResourceProviderTest, Image_GLTexture) {
3282 // Only for GL textures. 3283 // Only for GL textures.
3283 if (GetParam() != ResourceProvider::GLTexture) 3284 if (GetParam() != ResourceProvider::GLTexture)
3284 return; 3285 return;
3285 scoped_ptr<AllocationTrackingContext3D> context_owned( 3286 scoped_ptr<AllocationTrackingContext3D> context_owned(
3286 new StrictMock<AllocationTrackingContext3D>); 3287 new StrictMock<AllocationTrackingContext3D>);
3287 AllocationTrackingContext3D* context = context_owned.get(); 3288 AllocationTrackingContext3D* context = context_owned.get();
3288 3289
3289 FakeOutputSurfaceClient output_surface_client; 3290 FakeOutputSurfaceClient output_surface_client;
3290 scoped_ptr<OutputSurface> output_surface( 3291 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3291 FakeOutputSurface::Create3d(context_owned.Pass())); 3292 context_owned.PassAs<TestWebGraphicsContext3D>()));
3292 CHECK(output_surface->BindToClient(&output_surface_client)); 3293 CHECK(output_surface->BindToClient(&output_surface_client));
3293 3294
3294 const int kWidth = 2; 3295 const int kWidth = 2;
3295 const int kHeight = 2; 3296 const int kHeight = 2;
3296 gfx::Size size(kWidth, kHeight); 3297 gfx::Size size(kWidth, kHeight);
3297 ResourceFormat format = RGBA_8888; 3298 ResourceFormat format = RGBA_8888;
3298 ResourceProvider::ResourceId id = 0; 3299 ResourceProvider::ResourceId id = 0;
3299 const unsigned kTextureId = 123u; 3300 const unsigned kTextureId = 123u;
3300 const unsigned kImageId = 234u; 3301 const unsigned kImageId = 234u;
3301 3302
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 3391
3391 TEST_P(ResourceProviderTest, CopyResource_GLTexture) { 3392 TEST_P(ResourceProviderTest, CopyResource_GLTexture) {
3392 if (GetParam() != ResourceProvider::GLTexture) 3393 if (GetParam() != ResourceProvider::GLTexture)
3393 return; 3394 return;
3394 scoped_ptr<AllocationTrackingContext3D> context_owned( 3395 scoped_ptr<AllocationTrackingContext3D> context_owned(
3395 new StrictMock<AllocationTrackingContext3D>); 3396 new StrictMock<AllocationTrackingContext3D>);
3396 AllocationTrackingContext3D* context = context_owned.get(); 3397 AllocationTrackingContext3D* context = context_owned.get();
3397 context_owned->set_support_sync_query(true); 3398 context_owned->set_support_sync_query(true);
3398 3399
3399 FakeOutputSurfaceClient output_surface_client; 3400 FakeOutputSurfaceClient output_surface_client;
3400 scoped_ptr<OutputSurface> output_surface( 3401 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3401 FakeOutputSurface::Create3d(context_owned.Pass())); 3402 context_owned.PassAs<TestWebGraphicsContext3D>()));
3402 ASSERT_TRUE(output_surface->BindToClient(&output_surface_client)); 3403 ASSERT_TRUE(output_surface->BindToClient(&output_surface_client));
3403 3404
3404 const int kWidth = 2; 3405 const int kWidth = 2;
3405 const int kHeight = 2; 3406 const int kHeight = 2;
3406 gfx::Size size(kWidth, kHeight); 3407 gfx::Size size(kWidth, kHeight);
3407 ResourceFormat format = RGBA_8888; 3408 ResourceFormat format = RGBA_8888;
3408 ResourceProvider::ResourceId source_id = 0; 3409 ResourceProvider::ResourceId source_id = 0;
3409 ResourceProvider::ResourceId dest_id = 0; 3410 ResourceProvider::ResourceId dest_id = 0;
3410 const unsigned kSourceTextureId = 123u; 3411 const unsigned kSourceTextureId = 123u;
3411 const unsigned kDestTextureId = 321u; 3412 const unsigned kDestTextureId = 321u;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
3482 } 3483 }
3483 3484
3484 void InitializeGLAndCheck(ContextSharedData* shared_data, 3485 void InitializeGLAndCheck(ContextSharedData* shared_data,
3485 ResourceProvider* resource_provider, 3486 ResourceProvider* resource_provider,
3486 FakeOutputSurface* output_surface) { 3487 FakeOutputSurface* output_surface) {
3487 scoped_ptr<ResourceProviderContext> context_owned = 3488 scoped_ptr<ResourceProviderContext> context_owned =
3488 ResourceProviderContext::Create(shared_data); 3489 ResourceProviderContext::Create(shared_data);
3489 ResourceProviderContext* context = context_owned.get(); 3490 ResourceProviderContext* context = context_owned.get();
3490 3491
3491 scoped_refptr<TestContextProvider> context_provider = 3492 scoped_refptr<TestContextProvider> context_provider =
3492 TestContextProvider::Create(context_owned.Pass()); 3493 TestContextProvider::Create(
3494 context_owned.PassAs<TestWebGraphicsContext3D>());
3493 output_surface->InitializeAndSetContext3d(context_provider); 3495 output_surface->InitializeAndSetContext3d(context_provider);
3494 resource_provider->InitializeGL(); 3496 resource_provider->InitializeGL();
3495 3497
3496 CheckCreateResource(ResourceProvider::GLTexture, resource_provider, context); 3498 CheckCreateResource(ResourceProvider::GLTexture, resource_provider, context);
3497 } 3499 }
3498 3500
3499 TEST(ResourceProviderTest, BasicInitializeGLSoftware) { 3501 TEST(ResourceProviderTest, BasicInitializeGLSoftware) {
3500 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create(); 3502 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create();
3501 bool delegated_rendering = false; 3503 bool delegated_rendering = false;
3502 scoped_ptr<FakeOutputSurface> output_surface( 3504 scoped_ptr<FakeOutputSurface> output_surface(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3534 TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) { 3536 TEST_P(ResourceProviderTest, CompressedTextureETC1Allocate) {
3535 if (GetParam() != ResourceProvider::GLTexture) 3537 if (GetParam() != ResourceProvider::GLTexture)
3536 return; 3538 return;
3537 3539
3538 scoped_ptr<AllocationTrackingContext3D> context_owned( 3540 scoped_ptr<AllocationTrackingContext3D> context_owned(
3539 new AllocationTrackingContext3D); 3541 new AllocationTrackingContext3D);
3540 AllocationTrackingContext3D* context = context_owned.get(); 3542 AllocationTrackingContext3D* context = context_owned.get();
3541 context_owned->set_support_compressed_texture_etc1(true); 3543 context_owned->set_support_compressed_texture_etc1(true);
3542 3544
3543 FakeOutputSurfaceClient output_surface_client; 3545 FakeOutputSurfaceClient output_surface_client;
3544 scoped_ptr<OutputSurface> output_surface( 3546 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3545 FakeOutputSurface::Create3d(context_owned.Pass())); 3547 context_owned.PassAs<TestWebGraphicsContext3D>()));
3546 CHECK(output_surface->BindToClient(&output_surface_client)); 3548 CHECK(output_surface->BindToClient(&output_surface_client));
3547 3549
3548 gfx::Size size(4, 4); 3550 gfx::Size size(4, 4);
3549 scoped_ptr<ResourceProvider> resource_provider( 3551 scoped_ptr<ResourceProvider> resource_provider(
3550 ResourceProvider::Create(output_surface.get(), 3552 ResourceProvider::Create(output_surface.get(),
3551 shared_bitmap_manager_.get(), 3553 shared_bitmap_manager_.get(),
3552 NULL, 3554 NULL,
3553 0, 3555 0,
3554 false, 3556 false,
3555 1, 3557 1,
(...skipping 14 matching lines...) Expand all
3570 TEST_P(ResourceProviderTest, CompressedTextureETC1SetPixels) { 3572 TEST_P(ResourceProviderTest, CompressedTextureETC1SetPixels) {
3571 if (GetParam() != ResourceProvider::GLTexture) 3573 if (GetParam() != ResourceProvider::GLTexture)
3572 return; 3574 return;
3573 3575
3574 scoped_ptr<AllocationTrackingContext3D> context_owned( 3576 scoped_ptr<AllocationTrackingContext3D> context_owned(
3575 new AllocationTrackingContext3D); 3577 new AllocationTrackingContext3D);
3576 AllocationTrackingContext3D* context = context_owned.get(); 3578 AllocationTrackingContext3D* context = context_owned.get();
3577 context_owned->set_support_compressed_texture_etc1(true); 3579 context_owned->set_support_compressed_texture_etc1(true);
3578 3580
3579 FakeOutputSurfaceClient output_surface_client; 3581 FakeOutputSurfaceClient output_surface_client;
3580 scoped_ptr<OutputSurface> output_surface( 3582 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3581 FakeOutputSurface::Create3d(context_owned.Pass())); 3583 context_owned.PassAs<TestWebGraphicsContext3D>()));
3582 CHECK(output_surface->BindToClient(&output_surface_client)); 3584 CHECK(output_surface->BindToClient(&output_surface_client));
3583 3585
3584 gfx::Size size(4, 4); 3586 gfx::Size size(4, 4);
3585 scoped_ptr<ResourceProvider> resource_provider( 3587 scoped_ptr<ResourceProvider> resource_provider(
3586 ResourceProvider::Create(output_surface.get(), 3588 ResourceProvider::Create(output_surface.get(),
3587 shared_bitmap_manager_.get(), 3589 shared_bitmap_manager_.get(),
3588 NULL, 3590 NULL,
3589 0, 3591 0,
3590 false, 3592 false,
3591 1, 3593 1,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 return namespace_->next_texture_id; 3627 return namespace_->next_texture_id;
3626 } 3628 }
3627 }; 3629 };
3628 3630
3629 TEST(ResourceProviderTest, TextureAllocationChunkSize) { 3631 TEST(ResourceProviderTest, TextureAllocationChunkSize) {
3630 scoped_ptr<TextureIdAllocationTrackingContext> context_owned( 3632 scoped_ptr<TextureIdAllocationTrackingContext> context_owned(
3631 new TextureIdAllocationTrackingContext); 3633 new TextureIdAllocationTrackingContext);
3632 TextureIdAllocationTrackingContext* context = context_owned.get(); 3634 TextureIdAllocationTrackingContext* context = context_owned.get();
3633 3635
3634 FakeOutputSurfaceClient output_surface_client; 3636 FakeOutputSurfaceClient output_surface_client;
3635 scoped_ptr<OutputSurface> output_surface( 3637 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d(
3636 FakeOutputSurface::Create3d(context_owned.Pass())); 3638 context_owned.PassAs<TestWebGraphicsContext3D>()));
3637 CHECK(output_surface->BindToClient(&output_surface_client)); 3639 CHECK(output_surface->BindToClient(&output_surface_client));
3638 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( 3640 scoped_ptr<SharedBitmapManager> shared_bitmap_manager(
3639 new TestSharedBitmapManager()); 3641 new TestSharedBitmapManager());
3640 3642
3641 gfx::Size size(1, 1); 3643 gfx::Size size(1, 1);
3642 ResourceFormat format = RGBA_8888; 3644 ResourceFormat format = RGBA_8888;
3643 3645
3644 { 3646 {
3645 size_t kTextureAllocationChunkSize = 1; 3647 size_t kTextureAllocationChunkSize = 1;
3646 scoped_ptr<ResourceProvider> resource_provider( 3648 scoped_ptr<ResourceProvider> resource_provider(
(...skipping 30 matching lines...) Expand all
3677 resource_provider->AllocateForTesting(id); 3679 resource_provider->AllocateForTesting(id);
3678 Mock::VerifyAndClearExpectations(context); 3680 Mock::VerifyAndClearExpectations(context);
3679 3681
3680 DCHECK_EQ(10u, context->PeekTextureId()); 3682 DCHECK_EQ(10u, context->PeekTextureId());
3681 resource_provider->DeleteResource(id); 3683 resource_provider->DeleteResource(id);
3682 } 3684 }
3683 } 3685 }
3684 3686
3685 } // namespace 3687 } // namespace
3686 } // namespace cc 3688 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/task_graph_runner_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698