| 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 15 matching lines...) Expand all Loading... |
| 26 return BrowserGpuChannelHostFactory::instance(); | 26 return BrowserGpuChannelHostFactory::instance(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() { | 29 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() { |
| 30 scoped_refptr<GpuChannelHost> gpu_channel_host( | 30 scoped_refptr<GpuChannelHost> gpu_channel_host( |
| 31 GetFactory()->EstablishGpuChannelSync( | 31 GetFactory()->EstablishGpuChannelSync( |
| 32 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E)); | 32 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZ
E)); |
| 33 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( | 33 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context( |
| 34 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 34 WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 35 gpu_channel_host.get(), | 35 gpu_channel_host.get(), |
| 36 WebKit::WebGraphicsContext3D::Attributes(), | 36 blink::WebGraphicsContext3D::Attributes(), |
| 37 GURL("chrome://gpu/ContextProviderCommandBufferTest"))); | 37 GURL("chrome://gpu/ContextProviderCommandBufferTest"))); |
| 38 return context.Pass(); | 38 return context.Pass(); |
| 39 } | 39 } |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 IN_PROC_BROWSER_TEST_F(ContextProviderCommandBufferBrowserTest, LeakOnDestroy) { | 42 IN_PROC_BROWSER_TEST_F(ContextProviderCommandBufferBrowserTest, LeakOnDestroy) { |
| 43 scoped_refptr<ContextProviderCommandBuffer> provider = | 43 scoped_refptr<ContextProviderCommandBuffer> provider = |
| 44 ContextProviderCommandBuffer::Create(CreateContext3d(), "TestContext"); | 44 ContextProviderCommandBuffer::Create(CreateContext3d(), "TestContext"); |
| 45 provider->set_leak_on_destroy(); | 45 provider->set_leak_on_destroy(); |
| 46 EXPECT_TRUE(provider->BindToCurrentThread()); | 46 EXPECT_TRUE(provider->BindToCurrentThread()); |
| 47 // This should not crash. | 47 // This should not crash. |
| 48 provider = NULL; | 48 provider = NULL; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 } // namespace content | 52 } // namespace content |
| OLD | NEW |