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

Unified Diff: chromeos/binder/test_service.h

Issue 1575313002: Add CommandBroker::OnTransaction to handle incoming transactions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment Created 4 years, 11 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 | « chromeos/binder/ipc_thread.cc ('k') | chromeos/binder/test_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/binder/test_service.h
diff --git a/chromeos/binder/test_service.h b/chromeos/binder/test_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d01530448349645537de51cf28df745b5bd3e71
--- /dev/null
+++ b/chromeos/binder/test_service.h
@@ -0,0 +1,54 @@
+// Copyright 2015 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 CHROMEOS_BINDER_TEST_SERVICE_H_
+#define CHROMEOS_BINDER_TEST_SERVICE_H_
+
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "chromeos/binder/constants.h"
+#include "chromeos/binder/ipc_thread.h"
+
+namespace binder {
+
+// Service for testing.
+// Opens binder driver on its own thread and provides a service.
+// Note: Although this service runs in the same process as the test code, the
+// binder driver thinks this service is in a separate process because it owns a
+// separate binder driver FD itself.
+class TestService {
+ public:
+ enum {
+ INCREMENT_INT_TRANSACTION = kFirstTransactionCode,
+ };
+
+ TestService();
+ ~TestService();
+
+ // The name of this service.
+ const base::string16& service_name() const { return service_name_; }
+
+ // Starts the service and waits for it to complete initialization.
+ // Returns true on success.
+ bool StartAndWait();
+
+ // Stops this service.
+ void Stop();
+
+ private:
+ class TestObject;
+
+ // Initializes the service on the service thread.
+ // |result| will be set to true on success.
+ void Initialize(bool* result);
+
+ base::string16 service_name_;
+ IpcThread thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestService);
+};
+
+} // namespace binder
+
+#endif // CHROMEOS_BINDER_TEST_SERVICE_H_
« no previous file with comments | « chromeos/binder/ipc_thread.cc ('k') | chromeos/binder/test_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698