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

Unified Diff: cc/test/layer_tree_test.cc

Issue 12907011: cc: Allow command line flag to prevent unit test timeouts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_test.cc
diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
index 7726142d229e510ec93a0e6e72e046db5ce3c3ad..5170f85dc98ba0480108adabfdf4a749918f97bf 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);
« no previous file with comments | « cc/test/layer_tree_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698