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 78691d9eae1018c87eb78d4ccdf8ebaf304818ad..2c8f631e697022e6576879dcafa1a2ce5ff85a1e 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)); |
@@ -3046,10 +3041,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; |
@@ -3143,8 +3137,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); |
@@ -3259,8 +3251,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); |
@@ -3375,8 +3365,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); |
@@ -3464,8 +3452,6 @@ TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalOverInternal) |
TEST_P(LayerTreeHostImplTest, textureCachingWithOcclusionExternalNotAligned) |
{ |
- Settings::setPartialSwapEnabled(false); |
- |
LayerTreeSettings settings; |
scoped_ptr<LayerTreeHostImpl> myHostImpl = LayerTreeHostImpl::create(settings, this, &m_proxy); |
@@ -3538,10 +3524,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: |
@@ -3651,8 +3636,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); |
@@ -3758,10 +3741,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; |
@@ -3919,8 +3901,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); |