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

Unified Diff: mojo/shell/tests/lifecycle/app_client.h

Issue 1755423002: Add a test for application lifecycle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@27amtest
Patch Set: . Created 4 years, 10 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
« no previous file with comments | « mojo/shell/tests/lifecycle/app.cc ('k') | mojo/shell/tests/lifecycle/app_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/shell/tests/lifecycle/app_client.h
diff --git a/mojo/shell/tests/lifecycle/app_client.h b/mojo/shell/tests/lifecycle/app_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..5a7d5e6c2e32355a79793b40c6ecf18113174dac
--- /dev/null
+++ b/mojo/shell/tests/lifecycle/app_client.h
@@ -0,0 +1,64 @@
+// 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.
+
+#ifndef MOJO_SHELL_TESTS_LIFECYCLE_APP_CLIENT_H_
+#define MOJO_SHELL_TESTS_LIFECYCLE_APP_CLIENT_H_
+
+#include "base/bind.h"
+#include "base/macros.h"
+#include "mojo/public/cpp/bindings/binding_set.h"
+#include "mojo/shell/public/cpp/application_runner.h"
+#include "mojo/shell/public/cpp/interface_factory.h"
+#include "mojo/shell/public/cpp/shell_client.h"
+#include "mojo/shell/public/interfaces/shell_client.mojom.h"
+#include "mojo/shell/tests/lifecycle/lifecycle_unittest.mojom.h"
+
+using LifecycleControl = mojo::shell::test::mojom::LifecycleControl;
+using LifecycleControlRequest =
+ mojo::shell::test::mojom::LifecycleControlRequest;
+
+namespace mojo {
+class ShellConnection;
+namespace shell {
+namespace test {
+
+class AppClient : public ShellClient,
+ public InterfaceFactory<LifecycleControl>,
+ public LifecycleControl {
+ public:
+ AppClient();
+ explicit AppClient(shell::mojom::ShellClientRequest request);
+ ~AppClient() override;
+
+ void set_runner(ApplicationRunner* runner) {
+ runner_ = runner;
+ }
+
+ // ShellClient:
+ bool AcceptConnection(Connection* connection) override;
+
+ // InterfaceFactory<LifecycleControl>:
+ void Create(Connection* connection, LifecycleControlRequest request) override;
+
+ // LifecycleControl:
+ void Ping(const PingCallback& callback) override;
+ void GracefulQuit() override;
+ void Crash() override;
+ void CloseShellConnection() override;
+
+ private:
+ void BindingLost();
+
+ ApplicationRunner* runner_ = nullptr;
+ BindingSet<LifecycleControl> bindings_;
+ scoped_ptr<ShellConnection> connection_;
+
+ DISALLOW_COPY_AND_ASSIGN(AppClient);
+};
+
+} // namespace test
+} // namespace shell
+} // namespace mojo
+
+#endif // MOJO_SHELL_TESTS_LIFECYCLE_APP_CLIENT_H_
« no previous file with comments | « mojo/shell/tests/lifecycle/app.cc ('k') | mojo/shell/tests/lifecycle/app_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698