summaryrefslogtreecommitdiffstats
path: root/cc/test/fake_content_layer.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 02:08:12 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-04 02:08:12 +0000
commitd993b6009261f95c35a351450d5ebe401d5329b2 (patch)
treebea737921c010b3bb09fc62281e17fc6a711cdc7 /cc/test/fake_content_layer.cc
parentb408bfaac44edc0e5cdd6fae239b25cbefe704c2 (diff)
downloadchromium_src-d993b6009261f95c35a351450d5ebe401d5329b2.zip
chromium_src-d993b6009261f95c35a351450d5ebe401d5329b2.tar.gz
chromium_src-d993b6009261f95c35a351450d5ebe401d5329b2.tar.bz2
cc: Put context-loss tests in layer_tree_host_unittest_context.cc
These tests cover all of the cases covered by the context loss layout test and more. It also provides full coverage both in single-thread and multi-thread modes. I've moved tests from LayerTreeHostTests as usual, but also tests from LayerTreeHostImplTests, and implemented them using the real commit flow, instantiating layers by making the main thread versions of the layers, etc. This makes for a much more realistic test, and doesn't rely on as much internal compositor knowledge. While digging around, I found that the layersFreeTextures test was not testing anything. Then I also noticed that most of the layers in the test are not actually responsible to free their resources when they disappear. So I made the test do its job, and made the test just check layers that own resources - namely IOSurface and Video layers. Tests: LayerTreeHostContextTestLostContextSucceeds.runSingleThread LayerTreeHostContextTestLostContextSucceeds.runMultiThread LayerTreeHostContextTestLostContextSucceedsWithContent.NoSurface_SingleThread LayerTreeHostContextTestLostContextSucceedsWithContent.NoSurface_MultiThread LayerTreeHostContextTestLostContextSucceedsWithContent.WithSurface_SingleThread LayerTreeHostContextTestLostContextSucceedsWithContent.WithSurface_MultiThread LayerTreeHostContextTestLostContextFails.RepeatLoss100_SingleThread LayerTreeHostContextTestLostContextFails.RepeatLoss100_MultiThread LayerTreeHostContextTestLostContextFails.FailRecreate100_SingleThread LayerTreeHostContextTestLostContextFails.FailRecreate100_MultiThread LayerTreeHostContextTestFinishAllRenderingAfterLoss.runSingleThread LayerTreeHostContextTestFinishAllRenderingAfterLoss.runMultiThread LayerTreeHostContextTestLostContextAndEvictTextures.LoseAfterEvict_SingleThread LayerTreeHostContextTestLostContextAndEvictTextures.LoseAfterEvict_MultiThread LayerTreeHostContextTestLostContextAndEvictTextures.LoseBeforeEvict_SingleThread LayerTreeHostContextTestLostContextAndEvictTextures.LoseBeforeEvict_MultiThread LayerTreeHostContextTestLostContextWhileUpdatingResources.runSingleThread LayerTreeHostContextTestLostContextWhileUpdatingResources.runMultiThread LayerTreeHostContextTestLayersNotified.runSingleThread LayerTreeHostContextTestLayersNotified.runMultiThread LayerTreeHostContextTestDontUseLostResources.runSingleThread LayerTreeHostContextTestDontUseLostResources.runMultiThread Review URL: https://chromiumcodereview.appspot.com/11662003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175080 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/fake_content_layer.cc')
-rw-r--r--cc/test/fake_content_layer.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/cc/test/fake_content_layer.cc b/cc/test/fake_content_layer.cc
index f217e93..c103b24 100644
--- a/cc/test/fake_content_layer.cc
+++ b/cc/test/fake_content_layer.cc
@@ -4,6 +4,9 @@
#include "cc/test/fake_content_layer.h"
+#include "cc/prioritized_resource.h"
+#include "cc/test/fake_content_layer_impl.h"
+
namespace cc {
FakeContentLayer::FakeContentLayer(ContentLayerClient* client)
@@ -16,6 +19,11 @@ FakeContentLayer::FakeContentLayer(ContentLayerClient* client)
FakeContentLayer::~FakeContentLayer() {}
+scoped_ptr<LayerImpl> FakeContentLayer::createLayerImpl(
+ LayerTreeImpl* tree_impl) {
+ return FakeContentLayerImpl::Create(tree_impl, m_layerId).PassAs<LayerImpl>();
+}
+
void FakeContentLayer::update(
ResourceUpdateQueue& queue,
const OcclusionTracker* occlusion,
@@ -24,4 +32,9 @@ void FakeContentLayer::update(
update_count_++;
}
+bool FakeContentLayer::HaveBackingAt(int i, int j) {
+ const PrioritizedResource* resource = resourceAtForTesting(i, j);
+ return resource && resource->haveBackingTexture();
+}
+
} // namespace cc