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

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

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