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 3 // found in the LICENSE file. 4 5 #include "base/command_line.h" 6 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 7 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 8 #include "content/public/common/content_switches.h" 9 #include "content/test/content_browser_test.h" 10 #include "ui/gl/gl_switches.h" 11 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" 12 13 namespace { 14 15 class ContextTestBase : public content::ContentBrowserTest { 16 public: 17 virtual void SetUpOnMainThread() OVERRIDE { 18 CHECK(content::BrowserGpuChannelHostFactory::instance()); 19 context_.reset( 20 content::WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( 21 content::BrowserGpuChannelHostFactory::instance(), 22 WebKit::WebGraphicsContext3D::Attributes(), 23 GURL())); 24 CHECK(context_.get()); 25 context_->makeContextCurrent(); 26 ContentBrowserTest::SetUpOnMainThread(); 27 } 28 29 virtual void TearDownOnMainThread() OVERRIDE { 30 // Must delete the context first. 31 context_.reset(NULL); 32 ContentBrowserTest::TearDownOnMainThread(); 33 } 34 35 protected: 36 scoped_ptr<WebKit::WebGraphicsContext3D> context_; 37 }; 38 39 } // namespace 40 41 // Include the actual tests. 42 #define CONTEXT_TEST_F IN_PROC_BROWSER_TEST_F 43 #include "content/common/gpu/client/gpu_context_tests.h" 44