Chromium Code Reviews| Index: services/ui/view_manager/tests/view_manager_test_base.h |
| diff --git a/services/ui/view_manager/tests/view_manager_test_base.h b/services/ui/view_manager/tests/view_manager_test_base.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..99f7232745ad787a3b1447d3d749dd3df92d6bf2 |
| --- /dev/null |
| +++ b/services/ui/view_manager/tests/view_manager_test_base.h |
| @@ -0,0 +1,40 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/bind.h" |
| +#include "mojo/public/cpp/application/application_test_base.h" |
| + |
| +namespace view_manager { |
| +namespace test { |
| + |
| +const base::TimeDelta kDefaultMessageDelay = |
|
jeffbrown
2016/05/11 23:44:16
You can move this into the .cc file. Also, we don
|
| + base::TimeDelta::FromMilliseconds(4); |
| + |
| +// Run message loop until condition is true (timeout after 50*4ms = 200ms) |
|
jeffbrown
2016/05/11 23:44:16
I suspect this is why the test is flaky. We're ac
mikejurka
2016/05/16 23:35:18
You mean a lambda for the "while" condition? I fee
|
| +#define KICK_MESSAGE_LOOP_WHILE(x) \ |
| + for (int i = 0; x && i < 50; i++) { \ |
| + KickMessageLoop(); \ |
| + } |
| + |
| +class ViewManagerTestBase : public mojo::test::ApplicationTestBase { |
| + public: |
| + ViewManagerTestBase(); |
| + ~ViewManagerTestBase() override; |
| + |
| + void SetUp() override; |
| + |
| + void QuitMessageLoopCallback(); |
|
jeffbrown
2016/05/11 23:44:16
This doesn't need to be public, can be private.
mikejurka
2016/05/16 23:35:18
Done.
|
| + |
| + void KickMessageLoop(); |
| + |
| + protected: |
| + base::Closure quit_message_loop_callback_; |
| + base::WeakPtrFactory<ViewManagerTestBase> weak_factory_; |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase); |
| +}; |
| + |
| +} // namespace test |
| +} // namespace view_manager |