Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/bind.h" | |
| 6 #include "mojo/public/cpp/application/application_test_base.h" | |
| 7 | |
| 8 namespace view_manager { | |
| 9 namespace test { | |
| 10 | |
| 11 const base::TimeDelta kDefaultMessageDelay = | |
|
jeffbrown
2016/05/11 23:44:16
You can move this into the .cc file. Also, we don
| |
| 12 base::TimeDelta::FromMilliseconds(4); | |
| 13 | |
| 14 // 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
| |
| 15 #define KICK_MESSAGE_LOOP_WHILE(x) \ | |
| 16 for (int i = 0; x && i < 50; i++) { \ | |
| 17 KickMessageLoop(); \ | |
| 18 } | |
| 19 | |
| 20 class ViewManagerTestBase : public mojo::test::ApplicationTestBase { | |
| 21 public: | |
| 22 ViewManagerTestBase(); | |
| 23 ~ViewManagerTestBase() override; | |
| 24 | |
| 25 void SetUp() override; | |
| 26 | |
| 27 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.
| |
| 28 | |
| 29 void KickMessageLoop(); | |
| 30 | |
| 31 protected: | |
| 32 base::Closure quit_message_loop_callback_; | |
| 33 base::WeakPtrFactory<ViewManagerTestBase> weak_factory_; | |
| 34 | |
| 35 private: | |
| 36 DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase); | |
| 37 }; | |
| 38 | |
| 39 } // namespace test | |
| 40 } // namespace view_manager | |
| OLD | NEW |