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

Unified Diff: cc/test/layer_tree_test_common.cc

Issue 11478039: cc: Force layer tree tests to go idle before exiting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/test/layer_tree_test_common.h ('k') | cc/thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_test_common.cc
diff --git a/cc/test/layer_tree_test_common.cc b/cc/test/layer_tree_test_common.cc
index 88b4a8a94fd01db43ff906b63dd6c2996613fb47..e889f649dad09fc48ae3ee602f77e670e17596f3 100644
--- a/cc/test/layer_tree_test_common.cc
+++ b/cc/test/layer_tree_test_common.cc
@@ -272,7 +272,6 @@ ThreadedTest::ThreadedTest()
: m_beginning(false)
, m_endWhenBeginReturns(false)
, m_timedOut(false)
- , m_finished(false)
, m_scheduled(false)
, m_started(false)
, m_implThread(0)
@@ -285,8 +284,6 @@ ThreadedTest::~ThreadedTest()
void ThreadedTest::endTest()
{
- m_finished = true;
-
// For the case where we endTest during beginTest(), set a flag to indicate that
// the test should end the second beginTest regains control.
if (m_beginning)
@@ -374,7 +371,7 @@ void ThreadedTest::timeout()
void ThreadedTest::scheduleComposite()
{
- if (!m_started || m_scheduled || m_finished)
+ if (!m_started || m_scheduled)
return;
m_scheduled = true;
m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::dispatchComposite, base::Unretained(this)));
@@ -382,6 +379,11 @@ void ThreadedTest::scheduleComposite()
void ThreadedTest::realEndTest()
{
+ if (m_layerTreeHost && m_layerTreeHost->proxy()->commitPendingForTesting()) {
+ m_mainThreadProxy->postTask(FROM_HERE, base::Bind(&ThreadedTest::realEndTest, base::Unretained(this)));
+ return;
+ }
+
MessageLoop::current()->Quit();
}
@@ -389,9 +391,6 @@ void ThreadedTest::dispatchSetNeedsAnimate()
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get())
m_layerTreeHost->setNeedsAnimate();
}
@@ -400,9 +399,6 @@ void ThreadedTest::dispatchAddInstantAnimation()
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get() && m_layerTreeHost->rootLayer())
addOpacityTransitionToLayer(*m_layerTreeHost->rootLayer(), 0, 0, 0.5, false);
}
@@ -411,9 +407,6 @@ void ThreadedTest::dispatchAddAnimation(Layer* layerToReceiveAnimation)
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (layerToReceiveAnimation)
addOpacityTransitionToLayer(*layerToReceiveAnimation, 10, 0, 0.5, true);
}
@@ -422,9 +415,6 @@ void ThreadedTest::dispatchSetNeedsCommit()
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get())
m_layerTreeHost->setNeedsCommit();
}
@@ -433,9 +423,6 @@ void ThreadedTest::dispatchAcquireLayerTextures()
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get())
m_layerTreeHost->acquireLayerTextures();
}
@@ -444,9 +431,6 @@ void ThreadedTest::dispatchSetNeedsRedraw()
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get())
m_layerTreeHost->setNeedsRedraw();
}
@@ -455,9 +439,6 @@ void ThreadedTest::dispatchSetVisible(bool visible)
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get())
m_layerTreeHost->setVisible(visible);
}
@@ -465,7 +446,7 @@ void ThreadedTest::dispatchSetVisible(bool visible)
void ThreadedTest::dispatchComposite()
{
m_scheduled = false;
- if (m_layerTreeHost.get() && !m_finished)
+ if (m_layerTreeHost.get())
m_layerTreeHost->composite();
}
@@ -473,9 +454,6 @@ void ThreadedTest::dispatchDidAddAnimation()
{
DCHECK(!proxy() || proxy()->isMainThread());
- if (m_finished)
- return;
-
if (m_layerTreeHost.get())
m_layerTreeHost->didAddAnimation();
}
« no previous file with comments | « cc/test/layer_tree_test_common.h ('k') | cc/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698