diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-26 08:58:57 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-26 08:58:57 +0000 |
commit | 4fc1b7978116f5d6b5c1eed7e6a129b6a0fb6a19 (patch) | |
tree | c96e1295455e40d855285ffbe87902f01f07a773 /cc/test | |
parent | e1e768f583734578b5c76a1522cf9a0c7dfc871b (diff) | |
download | chromium_src-4fc1b7978116f5d6b5c1eed7e6a129b6a0fb6a19.zip chromium_src-4fc1b7978116f5d6b5c1eed7e6a129b6a0fb6a19.tar.gz chromium_src-4fc1b7978116f5d6b5c1eed7e6a129b6a0fb6a19.tar.bz2 |
cc: Allow command line flag to prevent unit test timeouts.
When running layer tree tests in gdb, they easily time out
while stepping through code. This allows a command line flag
to override the timeout behaviour so that you can run the
tests in gdb without having to comment out the Timeout()
method.
The flag is --cc-layer-tree-test-no-timeout to make sure it's
not given by accident on the bots.
R=enne
Review URL: https://chromiumcodereview.appspot.com/12907011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r-- | cc/test/layer_tree_test.cc | 19 | ||||
-rw-r--r-- | cc/test/layer_tree_test.h | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index 7726142..5170f85 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -4,6 +4,7 @@ #include "cc/test/layer_tree_test.h" +#include "base/command_line.h" #include "cc/animation/animation.h" #include "cc/animation/animation_registrar.h" #include "cc/animation/layer_animation_controller.h" @@ -311,9 +312,16 @@ LayerTreeTest::LayerTreeTest() schedule_when_set_visible_true_(false), started_(false), ended_(false), + timeout_seconds_(0), impl_thread_(NULL), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); + + // Tests should timeout quickly unless --cc-layer-tree-test-no-timeout was + // specified (for running in a debugger). + CommandLine* command_line = CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch("cc-layer-tree-test-no-timeout")) + timeout_seconds_ = 5; } LayerTreeTest::~LayerTreeTest() {} @@ -527,9 +535,14 @@ void LayerTreeTest::RunTest(bool threaded) { main_ccthread_->PostTask( base::Bind(&LayerTreeTest::DoBeginTest, base::Unretained(this))); - timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); - main_ccthread_->PostDelayedTask(timeout_.callback(), - base::TimeDelta::FromSeconds(5)); + + if (timeout_seconds_) { + timeout_.Reset(base::Bind(&LayerTreeTest::Timeout, base::Unretained(this))); + main_ccthread_->PostDelayedTask( + timeout_.callback(), + base::TimeDelta::FromSeconds(timeout_seconds_)); + } + MessageLoop::current()->Run(); if (layer_tree_host_ && layer_tree_host_->root_layer()) layer_tree_host_->root_layer()->SetLayerTreeHost(NULL); diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index 8302874..7f76d739f 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -156,6 +156,8 @@ class LayerTreeTest : public testing::Test, public TestHooks { bool started_; bool ended_; + int timeout_seconds_; + scoped_ptr<Thread> main_ccthread_; scoped_ptr<base::Thread> impl_thread_; base::CancelableClosure timeout_; |