Commit 1e16f5f8 authored by ericrk's avatar ericrk Committed by Commit bot

Fix LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated test

LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated test was incorrectly
relying on WillBeginImplFrameOnThread only being called once after the
OutputSurface was recreated. In reality, this function could be called
multiple times.

This patch causes us to handle cleanup in DidInitializeOutputSurface,
which will only be called once after recreating an OutputSurface.

BUG=642881,642836
CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel

Review-Url: https://codereview.chromium.org/2297413002
Cr-Commit-Position: refs/heads/master@{#415791}
parent eaa93027
...@@ -576,27 +576,38 @@ class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated ...@@ -576,27 +576,38 @@ class LayerTreeHostCacheBehaviorOnOutputSurfaceRecreated
public: public:
void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, void WillBeginImplFrameOnThread(LayerTreeHostImpl* host_impl,
const BeginFrameArgs& args) override { const BeginFrameArgs& args) override {
// This code is run once, to trigger recreation of our OutputSurface.
if (has_recreated_)
return;
// Ensure that our initialization expectations have completed. // Ensure that our initialization expectations have completed.
Mock::VerifyAndClearExpectations(mock_main_context_support_); Mock::VerifyAndClearExpectations(mock_main_context_support_);
Mock::VerifyAndClearExpectations(mock_worker_context_support_); Mock::VerifyAndClearExpectations(mock_worker_context_support_);
if (has_recreated_) {
// Destruction exptectations.
EXPECT_CALL(*mock_worker_context_support_,
SetAggressivelyFreeResources(true));
EXPECT_CALL(*mock_main_context_support_,
SetAggressivelyFreeResources(true));
EndTest();
return;
}
has_recreated_ = true;
// Output surface lost expectations. // Output surface lost expectations.
EXPECT_CALL(*mock_worker_context_support_, EXPECT_CALL(*mock_worker_context_support_,
SetAggressivelyFreeResources(true)); SetAggressivelyFreeResources(true));
EXPECT_CALL(*mock_main_context_support_, EXPECT_CALL(*mock_main_context_support_,
SetAggressivelyFreeResources(true)); SetAggressivelyFreeResources(true));
host_impl->DidLoseOutputSurface(); host_impl->DidLoseOutputSurface();
has_recreated_ = true;
}
void DidInitializeOutputSurface() override {
// This is run after we have recreated our OutputSurface.
if (!has_recreated_)
return;
// Ensure that our initialization expectations have completed.
Mock::VerifyAndClearExpectations(mock_main_context_support_);
Mock::VerifyAndClearExpectations(mock_worker_context_support_);
// Destruction exptectations.
EXPECT_CALL(*mock_worker_context_support_,
SetAggressivelyFreeResources(true));
EXPECT_CALL(*mock_main_context_support_,
SetAggressivelyFreeResources(true));
EndTest();
} }
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment