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..4198be4ff8ebb12c467c95888fc058d66c73e27a |
--- /dev/null |
+++ b/services/ui/view_manager/tests/view_manager_test_base.h |
@@ -0,0 +1,39 @@ |
+// 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 = |
+ base::TimeDelta::FromMilliseconds(10); |
+ |
+// Run message loop until condition is true (timeout after 400*10ms = 4000ms) |
+#define KICK_MESSAGE_LOOP_WHILE(x) \ |
+ for (int i = 0; x && i < 400; i++) { \ |
+ KickMessageLoop(); \ |
+ } |
+ |
+class ViewManagerTestBase : public mojo::test::ApplicationTestBase { |
+ public: |
+ ViewManagerTestBase(); |
+ ~ViewManagerTestBase() override; |
+ |
+ void SetUp() override; |
+ void KickMessageLoop(); |
+ |
+ protected: |
+ base::Closure quit_message_loop_callback_; |
+ base::WeakPtrFactory<ViewManagerTestBase> weak_factory_; |
+ |
+ private: |
+ void QuitMessageLoopCallback(); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ViewManagerTestBase); |
+}; |
+ |
+} // namespace test |
+} // namespace view_manager |