OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/gpu/browser_gpu_channel_host_factory.h" | 5 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
6 #include "content/common/gpu/client/context_provider_command_buffer.h" | 6 #include "content/common/gpu/client/context_provider_command_buffer.h" |
7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" | 7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
8 #include "content/test/content_browser_test.h" | 8 #include "content/test/content_browser_test.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() { | 32 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() { |
33 scoped_refptr<GpuChannelHost> gpu_channel_host( | 33 scoped_refptr<GpuChannelHost> gpu_channel_host( |
34 GetFactory()->EstablishGpuChannelSync( | 34 GetFactory()->EstablishGpuChannelSync( |
35 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E)); | 35 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E)); |
36 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 36 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
37 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 37 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
38 gpu_channel_host.get(), | 38 gpu_channel_host.get(), |
39 blink::WebGraphicsContext3D::Attributes(), | 39 blink::WebGraphicsContext3D::Attributes(), |
40 GURL("chrome://gpu/ContextProviderCommandBufferTest"), | 40 GURL("chrome://gpu/ContextProviderCommandBufferTest"), |
41 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits())); | 41 WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), |
| 42 NULL)); |
42 return context.Pass(); | 43 return context.Pass(); |
43 } | 44 } |
44 }; | 45 }; |
45 | 46 |
46 IN_PROC_BROWSER_TEST_F(ContextProviderCommandBufferBrowserTest, LeakOnDestroy) { | 47 IN_PROC_BROWSER_TEST_F(ContextProviderCommandBufferBrowserTest, LeakOnDestroy) { |
47 if (!BrowserGpuChannelHostFactory::CanUseForTesting()) | 48 if (!BrowserGpuChannelHostFactory::CanUseForTesting()) |
48 return; | 49 return; |
49 | 50 |
50 scoped_refptr<ContextProviderCommandBuffer> provider = | 51 scoped_refptr<ContextProviderCommandBuffer> provider = |
51 ContextProviderCommandBuffer::Create(CreateContext3d(), "TestContext"); | 52 ContextProviderCommandBuffer::Create(CreateContext3d(), "TestContext"); |
52 provider->set_leak_on_destroy(); | 53 provider->set_leak_on_destroy(); |
53 EXPECT_TRUE(provider->BindToCurrentThread()); | 54 EXPECT_TRUE(provider->BindToCurrentThread()); |
54 // This should not crash. | 55 // This should not crash. |
55 provider = NULL; | 56 provider = NULL; |
56 } | 57 } |
57 | 58 |
58 } // namespace | 59 } // namespace |
59 } // namespace content | 60 } // namespace content |
OLD | NEW |