summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/fake_graphics_context.h22
-rw-r--r--cc/test/fake_output_surface.h22
-rw-r--r--cc/test/fake_proxy.cc4
-rw-r--r--cc/test/fake_proxy.h6
-rw-r--r--cc/test/fake_web_graphics_context_3d_unittest.cc31
5 files changed, 58 insertions, 27 deletions
diff --git a/cc/test/fake_graphics_context.h b/cc/test/fake_graphics_context.h
deleted file mode 100644
index aecfcc4..0000000
--- a/cc/test/fake_graphics_context.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CC_TEST_FAKE_GRAPHICS_CONTEXT_H_
-#define CC_TEST_FAKE_GRAPHICS_CONTEXT_H_
-
-#include "cc/graphics_context.h"
-#include "cc/test/compositor_fake_web_graphics_context_3d.h"
-#include "cc/test/fake_web_compositor_output_surface.h"
-#include <public/WebCompositorOutputSurface.h>
-
-namespace WebKit {
-
-static inline scoped_ptr<cc::GraphicsContext> createFakeGraphicsContext()
-{
- return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3D::create(WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::GraphicsContext>();
-}
-
-} // namespace WebKit
-
-#endif // CC_TEST_FAKE_GRAPHICS_CONTEXT_H_
diff --git a/cc/test/fake_output_surface.h b/cc/test/fake_output_surface.h
new file mode 100644
index 0000000..69bce19
--- /dev/null
+++ b/cc/test/fake_output_surface.h
@@ -0,0 +1,22 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TEST_FAKE_OUTPUT_SURFACE_H_
+#define CC_TEST_FAKE_OUTPUT_SURFACE_H_
+
+#include "cc/output_surface.h"
+#include "cc/test/compositor_fake_web_graphics_context_3d.h"
+#include "cc/test/fake_web_compositor_output_surface.h"
+#include <public/WebCompositorOutputSurface.h>
+
+namespace cc {
+
+static inline scoped_ptr<cc::OutputSurface> createFakeOutputSurface()
+{
+ return WebKit::FakeWebCompositorOutputSurface::create(WebKit::CompositorFakeWebGraphicsContext3D::create(WebKit::WebGraphicsContext3D::Attributes()).PassAs<WebKit::WebGraphicsContext3D>()).PassAs<cc::OutputSurface>();
+}
+
+} // namespace WebKit
+
+#endif // CC_TEST_FAKE_OUTPUT_SURFACE_H_
diff --git a/cc/test/fake_proxy.cc b/cc/test/fake_proxy.cc
index d485056..df2c072 100644
--- a/cc/test/fake_proxy.cc
+++ b/cc/test/fake_proxy.cc
@@ -16,7 +16,7 @@ bool FakeProxy::isStarted() const
return true;
}
-bool FakeProxy::initializeContext()
+bool FakeProxy::initializeOutputSurface()
{
return true;
}
@@ -26,7 +26,7 @@ bool FakeProxy::initializeRenderer()
return true;
}
-bool FakeProxy::recreateContext()
+bool FakeProxy::recreateOutputSurface()
{
return true;
}
diff --git a/cc/test/fake_proxy.h b/cc/test/fake_proxy.h
index 3bbacb5..c89f120 100644
--- a/cc/test/fake_proxy.h
+++ b/cc/test/fake_proxy.h
@@ -19,11 +19,11 @@ public:
virtual void startPageScaleAnimation(gfx::Vector2d targetPosition, bool useAnchor, float scale, base::TimeDelta duration) OVERRIDE { }
virtual void finishAllRendering() OVERRIDE { }
virtual bool isStarted() const OVERRIDE;
- virtual bool initializeContext() OVERRIDE;
+ virtual bool initializeOutputSurface() OVERRIDE;
virtual void setSurfaceReady() OVERRIDE { }
virtual void setVisible(bool) OVERRIDE { }
virtual bool initializeRenderer() OVERRIDE;
- virtual bool recreateContext() OVERRIDE;
+ virtual bool recreateOutputSurface() OVERRIDE;
virtual void renderingStats(RenderingStats*) OVERRIDE { }
virtual const RendererCapabilities& rendererCapabilities() const OVERRIDE;
virtual void setNeedsAnimate() OVERRIDE { }
@@ -37,7 +37,7 @@ public:
virtual void forceSerializeOnSwapBuffers() OVERRIDE { }
virtual size_t maxPartialTextureUpdates() const OVERRIDE;
virtual void acquireLayerTextures() OVERRIDE { }
- virtual void loseContext() OVERRIDE { }
+ virtual void loseOutputSurface() OVERRIDE { }
virtual RendererCapabilities& rendererCapabilities();
void setMaxPartialTextureUpdates(size_t);
diff --git a/cc/test/fake_web_graphics_context_3d_unittest.cc b/cc/test/fake_web_graphics_context_3d_unittest.cc
new file mode 100644
index 0000000..ade749f
--- /dev/null
+++ b/cc/test/fake_web_graphics_context_3d_unittest.cc
@@ -0,0 +1,31 @@
+// Copyright 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/test/fake_web_graphics_context_3d.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class ContextThatCountsMakeCurrents : public WebKit::FakeWebGraphicsContext3D {
+public:
+ ContextThatCountsMakeCurrents() : m_makeCurrentCount(0) { }
+ virtual bool makeContextCurrent() OVERRIDE
+ {
+ m_makeCurrentCount++;
+ return true;
+ }
+ int makeCurrentCount() const { return m_makeCurrentCount; }
+
+private:
+ int m_makeCurrentCount;
+};
+
+
+TEST(FakeWebGraphicsContext3DTest, CreationShouldNotMakeCurrent)
+{
+ scoped_ptr<ContextThatCountsMakeCurrents> context(new ContextThatCountsMakeCurrents);
+ EXPECT_TRUE(context.get());
+ EXPECT_EQ(0, context->makeCurrentCount());
+}