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

Unified Diff: services/ui/view_manager/tests/view_manager_test_base.h

Issue 1949233002: Create a RegisterViewAssociate method in ViewManager (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: tiny bit more cleanup Created 4 years, 7 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
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

Powered by Google App Engine
This is Rietveld 408576698