Index: content/browser/gpu/gpu_ipc_browsertests.cc |
diff --git a/content/browser/gpu/gpu_ipc_browsertests.cc b/content/browser/gpu/gpu_ipc_browsertests.cc |
index 3d0fa0c41c30747d727f71696fa73ebe09aac5b8..7c644013e2374cd6ced80ca02b1295d515c594d9 100644 |
--- a/content/browser/gpu/gpu_ipc_browsertests.cc |
+++ b/content/browser/gpu/gpu_ipc_browsertests.cc |
@@ -2,97 +2,37 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "base/run_loop.h" |
-#include "cc/resources/sync_point_helper.h" |
#include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
#include "content/test/content_browser_test.h" |
-#include "gpu/GLES2/gl2extchromium.h" |
#include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" |
-namespace content { |
namespace { |
-enum ContextType { |
- GPU_SERVICE_CONTEXT, |
- IN_PROCESS_CONTEXT, |
-}; |
- |
-class SignalBrowserTest |
- : public ContentBrowserTest, |
- public ::testing::WithParamInterface<ContextType> { |
+class ContextTestBase : public content::ContentBrowserTest { |
public: |
- virtual void SetUp() { |
- switch (GetParam()) { |
- case GPU_SERVICE_CONTEXT: |
- context_.reset( |
- WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
- BrowserGpuChannelHostFactory::instance(), |
- WebKit::WebGraphicsContext3D::Attributes(), |
- GURL())); |
- break; |
- case IN_PROCESS_CONTEXT: |
- context_ = |
- webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: |
- CreateOffscreenContext(WebKit::WebGraphicsContext3D::Attributes()); |
- break; |
- } |
- } |
- |
- // These tests should time out if the callback doesn't get called. |
- void testSignalSyncPoint(unsigned sync_point) { |
- base::RunLoop run_loop; |
- cc::SyncPointHelper::SignalSyncPoint( |
- context_.get(), sync_point, run_loop.QuitClosure()); |
- run_loop.Run(); |
+ virtual void SetUpOnMainThread() OVERRIDE { |
+ context_.reset( |
+ content::WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
+ content::BrowserGpuChannelHostFactory::instance(), |
+ WebKit::WebGraphicsContext3D::Attributes(), |
+ GURL())); |
+ context_->makeContextCurrent(); |
+ ContentBrowserTest::SetUpOnMainThread(); |
} |
- // These tests should time out if the callback doesn't get called. |
- void testSignalQuery(WebKit::WebGLId query) { |
- base::RunLoop run_loop; |
- cc::SyncPointHelper::SignalQuery( |
- context_.get(), query, run_loop.QuitClosure()); |
- run_loop.Run(); |
+ virtual void TearDownOnMainThread() OVERRIDE { |
+ // Must delete the context first. |
+ context_.reset(NULL); |
+ ContentBrowserTest::TearDownOnMainThread(); |
} |
protected: |
scoped_ptr<WebKit::WebGraphicsContext3D> context_; |
}; |
-IN_PROC_BROWSER_TEST_P(SignalBrowserTest, BasicSignalSyncPointTest) { |
- testSignalSyncPoint(context_->insertSyncPoint()); |
-}; |
- |
-IN_PROC_BROWSER_TEST_P(SignalBrowserTest, InvalidSignalSyncPointTest) { |
- // Signalling something that doesn't exist should run the callback |
- // immediately. |
- testSignalSyncPoint(1297824234); |
-}; |
- |
-IN_PROC_BROWSER_TEST_P(SignalBrowserTest, BasicSignalQueryTest) { |
- unsigned query = context_->createQueryEXT(); |
- context_->beginQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM, query); |
- context_->finish(); |
- context_->endQueryEXT(GL_COMMANDS_ISSUED_CHROMIUM); |
- testSignalQuery(query); |
- context_->deleteQueryEXT(query); |
-}; |
- |
-IN_PROC_BROWSER_TEST_P(SignalBrowserTest, SignalQueryUnboundTest) { |
- WebKit::WebGLId query = context_->createQueryEXT(); |
- testSignalQuery(query); |
- context_->deleteQueryEXT(query); |
-}; |
- |
-IN_PROC_BROWSER_TEST_P(SignalBrowserTest, InvalidSignalQueryUnboundTest) { |
- // Signalling something that doesn't exist should run the callback |
- // immediately. |
- testSignalQuery(928729087); |
-}; |
- |
-INSTANTIATE_TEST_CASE_P(, SignalBrowserTest, |
- ::testing::Values(GPU_SERVICE_CONTEXT, |
- IN_PROCESS_CONTEXT)); |
- |
} // namespace |
-} // namespace content |
+ |
+// Include the actual tests. |
+#define CONTEXT_TEST_F IN_PROC_BROWSER_TEST_F |
+#include "content/browser/gpu/gpu_context_tests.h" |