OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMEOS_BINDER_TEST_SERVICE_H_ |
| 6 #define CHROMEOS_BINDER_TEST_SERVICE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/strings/string16.h" |
| 10 #include "chromeos/binder/constants.h" |
| 11 #include "chromeos/binder/ipc_thread.h" |
| 12 |
| 13 namespace binder { |
| 14 |
| 15 // Service for testing. |
| 16 // Opens binder driver on its own thread and provides a service. |
| 17 // Note: Although this service runs in the same process as the test code, the |
| 18 // binder driver thinks this service is in a separate process because it owns a |
| 19 // separate binder driver FD itself. |
| 20 class TestService { |
| 21 public: |
| 22 enum { |
| 23 INCREMENT_INT_TRANSACTION = kFirstTransactionCode, |
| 24 }; |
| 25 |
| 26 TestService(); |
| 27 ~TestService(); |
| 28 |
| 29 // The name of this service. |
| 30 const base::string16& service_name() const { return service_name_; } |
| 31 |
| 32 // Starts the service and waits for it to complete initialization. |
| 33 // Returns true on success. |
| 34 bool StartAndWait(); |
| 35 |
| 36 // Stops this service. |
| 37 void Stop(); |
| 38 |
| 39 private: |
| 40 class TestObject; |
| 41 |
| 42 // Initializes the service on the service thread. |
| 43 // |result| will be set to true on success. |
| 44 void Initialize(bool* result); |
| 45 |
| 46 base::string16 service_name_; |
| 47 IpcThread thread_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(TestService); |
| 50 }; |
| 51 |
| 52 } // namespace binder |
| 53 |
| 54 #endif // CHROMEOS_BINDER_TEST_SERVICE_H_ |
OLD | NEW |