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

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

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.cc
diff --git a/services/ui/view_manager/tests/view_manager_test_base.cc b/services/ui/view_manager/tests/view_manager_test_base.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e123720cff9ea54e89bd0ae39bbb2d2abc80b13a
--- /dev/null
+++ b/services/ui/view_manager/tests/view_manager_test_base.cc
@@ -0,0 +1,38 @@
+// 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 "services/ui/view_manager/tests/view_manager_test_base.h"
+
+#include "base/run_loop.h"
+#include "mojo/public/cpp/application/application_test_base.h"
+#include "mojo/public/cpp/application/connect.h"
+#include "mojo/services/ui/views/interfaces/view_manager.mojom.h"
+#include "mojo/services/ui/views/interfaces/views.mojom.h"
+
+namespace view_manager {
+namespace test {
+
+ViewManagerTestBase::ViewManagerTestBase() : weak_factory_(this) {}
+
+ViewManagerTestBase::~ViewManagerTestBase() {}
+
+void ViewManagerTestBase::SetUp() {
+ mojo::test::ApplicationTestBase::SetUp();
+ quit_message_loop_callback_ =
+ base::Bind(&ViewManagerTestBase::QuitMessageLoopCallback,
+ weak_factory_.GetWeakPtr());
+}
+
+void ViewManagerTestBase::QuitMessageLoopCallback() {
+ base::MessageLoop::current()->Quit();
+}
+
+void ViewManagerTestBase::KickMessageLoop() {
+ base::MessageLoop::current()->PostDelayedTask(
+ FROM_HERE, quit_message_loop_callback_, kDefaultMessageDelay);
+ base::MessageLoop::current()->Run();
+}
+
+} // namespace test
+} // namespace view_manager

Powered by Google App Engine
This is Rietveld 408576698