Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7610)

Unified Diff: cc/layer_tree_host_impl_unittest.cc

Issue 11361223: cc: Remove cc::settings, move them to LayerTreeSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix-unittests Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tree_host_impl_unittest.cc
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index ce71ced10d8f1f5c504d3e2adfa3d0ce72ebfd03..9a50c7b82b2fd83fa304ed44e9d3752660d9f175 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -21,7 +21,6 @@
#include "cc/render_pass_draw_quad.h"
#include "cc/scrollbar_geometry_fixed_thumb.h"
#include "cc/scrollbar_layer_impl.h"
-#include "cc/settings.h"
#include "cc/single_thread_proxy.h"
#include "cc/solid_color_draw_quad.h"
#include "cc/test/animation_test_common.h"
@@ -32,7 +31,6 @@
#include "cc/test/geometry_test_utils.h"
#include "cc/test/layer_test_common.h"
#include "cc/test/render_pass_test_common.h"
-#include "cc/test/test_common.h"
#include "cc/texture_draw_quad.h"
#include "cc/texture_layer_impl.h"
#include "cc/tile_draw_quad.h"
@@ -62,9 +60,9 @@ namespace cc {
namespace {
// This test is parametrized to run all tests with the
-// Settings::pageScalePinchZoomEnabled field enabled and disabled.
+// m_settings.pageScalePinchZoomEnabled field enabled and disabled.
class LayerTreeHostImplTest : public testing::TestWithParam<bool>,
- public LayerTreeHostImplClient {
+ public LayerTreeHostImplClient {
public:
LayerTreeHostImplTest()
: m_proxy(scoped_ptr<Thread>(NULL))
@@ -80,9 +78,9 @@ public:
virtual void SetUp()
{
- Settings::setPageScalePinchZoomEnabled(GetParam());
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
+ settings.pageScalePinchZoomEnabled = GetParam();
m_hostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
m_hostImpl->initializeRenderer(createContext());
@@ -107,10 +105,9 @@ public:
scoped_ptr<LayerTreeHostImpl> createLayerTreeHost(bool partialSwap, scoped_ptr<GraphicsContext> graphicsContext, scoped_ptr<LayerImpl> root)
{
- Settings::setPartialSwapEnabled(partialSwap);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
+ settings.partialSwapEnabled = partialSwap;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
@@ -204,7 +201,6 @@ protected:
bool m_didRequestCommit;
bool m_didRequestRedraw;
bool m_reduceMemoryResult;
- ScopedSettings m_scopedSettings;
};
class FakeWebGraphicsContext3DMakeCurrentFails : public FakeWebGraphicsContext3D {
@@ -499,7 +495,7 @@ TEST_P(LayerTreeHostImplTest, maxScrollOffsetChangedByDeviceScaleFactor)
TEST_P(LayerTreeHostImplTest, implPinchZoom)
{
// This test is specific to the page-scale based pinch zoom.
- if (!Settings::pageScalePinchZoomEnabled())
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled)
return;
setupScrollAndContentsLayers(gfx::Size(100, 100));
@@ -562,7 +558,7 @@ TEST_P(LayerTreeHostImplTest, pinchGesture)
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
DCHECK(scrollLayer);
- const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5;
+ const float minPageScale = m_hostImpl->settings().pageScalePinchZoomEnabled ? 1 : 0.5;
const float maxPageScale = 4;
const WebTransformationMatrix identityScaleTransform;
@@ -613,7 +609,7 @@ TEST_P(LayerTreeHostImplTest, pinchGesture)
scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
- if (!Settings::pageScalePinchZoomEnabled()) {
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled) {
// Pushed to (0,0) via clamping against contents layer size.
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(-50, -50));
} else {
@@ -701,7 +697,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
LayerImpl* scrollLayer = m_hostImpl->rootScrollLayer();
DCHECK(scrollLayer);
- const float minPageScale = Settings::pageScalePinchZoomEnabled() ? 1 : 0.5;
+ const float minPageScale = m_hostImpl->settings().pageScalePinchZoomEnabled ? 1 : 0.5;
const float maxPageScale = 4;
// Pinch zoom in.
@@ -722,7 +718,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
m_hostImpl->pinchGestureEnd();
scrollInfo = m_hostImpl->processScrollDeltas();
EXPECT_EQ(scrollInfo->pageScaleDelta, zoomInDelta);
- if (!Settings::pageScalePinchZoomEnabled()) {
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled) {
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(25, 25));
} else {
EXPECT_TRUE(scrollInfo->scrolls.empty());
@@ -740,7 +736,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
// Since we are pinch zooming out, we should get an update to zoom all
// the way out to the minimum page scale.
scoped_ptr<ScrollAndScaleSet> scrollInfo = m_hostImpl->processScrollDeltas();
- if (!Settings::pageScalePinchZoomEnabled()) {
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled) {
EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(0, 0));
} else {
@@ -751,7 +747,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhilePinchZooming)
// Once the gesture ends, we get the final scroll and page scale values.
m_hostImpl->pinchGestureEnd();
scrollInfo = m_hostImpl->processScrollDeltas();
- if (Settings::pageScalePinchZoomEnabled()) {
+ if (m_hostImpl->settings().pageScalePinchZoomEnabled) {
EXPECT_EQ(scrollInfo->pageScaleDelta, minPageScale);
expectContains(*scrollInfo, scrollLayer->id(), gfx::Vector2d(25, 25));
} else {
@@ -780,7 +776,7 @@ TEST_P(LayerTreeHostImplTest, inhibitScrollAndPageScaleUpdatesWhileAnimatingPage
const float pageScaleDelta = 2;
gfx::Vector2d target(25, 25);
gfx::Vector2d scaledTarget = target;
- if (!Settings::pageScalePinchZoomEnabled())
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled)
scaledTarget = gfx::Vector2d(12, 12);
m_hostImpl->setPageScaleFactorAndLimits(1, minPageScale, maxPageScale);
@@ -1170,7 +1166,7 @@ TEST_P(LayerTreeHostImplTest, scrollRootAndChangePageScaleOnMainThread)
// Set new page scale from main thread.
m_hostImpl->setPageScaleFactorAndLimits(pageScale, pageScale, pageScale);
- if (!Settings::pageScalePinchZoomEnabled()) {
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled) {
// The scale should apply to the scroll delta.
expectedScrollDelta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(expectedScrollDelta, pageScale));
}
@@ -1293,7 +1289,7 @@ TEST_P(LayerTreeHostImplTest, scrollChildAndChangePageScaleOnMainThread)
m_hostImpl->updateRootScrollLayerImplTransform();
- if (!Settings::pageScalePinchZoomEnabled()) {
+ if (!m_hostImpl->settings().pageScalePinchZoomEnabled) {
// The scale should apply to the scroll delta.
expectedScrollDelta = gfx::ToFlooredVector2d(gfx::ScaleVector2d(expectedScrollDelta, pageScale));
}
@@ -1957,7 +1953,7 @@ TEST_P(LayerTreeHostImplTest, partialSwapReceivesDamageRect)
// This test creates its own LayerTreeHostImpl, so
// that we can force partial swap enabled.
LayerTreeSettings settings;
- Settings::setPartialSwapEnabled(true);
+ settings.partialSwapEnabled = true;
scoped_ptr<LayerTreeHostImpl> layerTreeHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
layerTreeHostImpl->initializeRenderer(outputSurface.Pass());
layerTreeHostImpl->setViewportSize(gfx::Size(500, 500), gfx::Size(500, 500));
@@ -2240,11 +2236,10 @@ public:
static scoped_ptr<LayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, LayerTreeHostImplClient* client, Proxy* proxy)
{
- Settings::setPartialSwapEnabled(partialSwap);
-
scoped_ptr<GraphicsContext> context = FakeWebCompositorOutputSurface::create(scoped_ptr<WebKit::WebGraphicsContext3D>(new PartialSwapContext)).PassAs<GraphicsContext>();
LayerTreeSettings settings;
+ settings.partialSwapEnabled = partialSwap;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, client, proxy);
myHostImpl->initializeRenderer(context.Pass());
myHostImpl->setViewportSize(gfx::Size(100, 100), gfx::Size(100, 100));
@@ -3050,10 +3045,9 @@ public:
TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
{
- Settings::setPartialSwapEnabled(true);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
+ settings.partialSwapEnabled = true;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
LayerImpl* rootPtr;
@@ -3147,8 +3141,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithClipping)
TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
{
- Settings::setPartialSwapEnabled(false);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
@@ -3263,8 +3255,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusion)
TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
{
- Settings::setPartialSwapEnabled(false);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
@@ -3379,8 +3369,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionEarlyOut)
TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
{
- Settings::setPartialSwapEnabled(false);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
@@ -3468,8 +3456,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal)
TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
{
- Settings::setPartialSwapEnabled(false);
-
LayerTreeSettings settings;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
@@ -3542,10 +3528,9 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned)
TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
{
- Settings::setPartialSwapEnabled(true);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
+ settings.partialSwapEnabled = true;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
// Layers are structure as follows:
@@ -3655,8 +3640,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionPartialSwap)
TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
{
- Settings::setPartialSwapEnabled(false);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
@@ -3762,10 +3745,9 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithScissor)
TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
{
- Settings::setPartialSwapEnabled(true);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
+ settings.partialSwapEnabled = true;
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
LayerImpl* rootPtr;
@@ -3923,8 +3905,6 @@ TEST_P(LayerTreeHostImplTest, surfaceTextureCaching)
TEST_P(LayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap)
{
- Settings::setPartialSwapEnabled(false);
-
LayerTreeSettings settings;
settings.minimumOcclusionTrackingSize = gfx::Size();
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy);
« no previous file with comments | « cc/layer_tree_host_impl.cc ('k') | cc/layer_tree_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698