diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 04:37:17 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-06 04:37:17 +0000 |
commit | 3b9f2df0b78911631b92fff4c174a37fd8077482 (patch) | |
tree | 7eceed9124cdad273658f9c813a51ccd37bfcdf0 /cc/test | |
parent | 5b3065b13476000a1940aeabfec125c736d687da (diff) | |
download | chromium_src-3b9f2df0b78911631b92fff4c174a37fd8077482.zip chromium_src-3b9f2df0b78911631b92fff4c174a37fd8077482.tar.gz chromium_src-3b9f2df0b78911631b92fff4c174a37fd8077482.tar.bz2 |
cc: Finish the rename from cc::GraphicsContext to cc::OutputSurface
It is far too confusing to deal with OutputSurface code when half the time it is
called a GraphicsContext in correctly. Cleaning this up so I can think about the
code properly as I upstream the Ubercomp CL.
NOTRY=true
R=jamesr,piman
BUG=146080
Review URL: https://chromiumcodereview.appspot.com/11450019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/fake_graphics_context.h | 22 | ||||
-rw-r--r-- | cc/test/fake_output_surface.h | 22 | ||||
-rw-r--r-- | cc/test/fake_proxy.cc | 4 | ||||
-rw-r--r-- | cc/test/fake_proxy.h | 6 | ||||
-rw-r--r-- | cc/test/fake_web_graphics_context_3d_unittest.cc | 31 |
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()); +} |