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

Unified Diff: dbus/test_service.h

Issue 11358111: Make SignalSenderVerificationTest more robust (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix uninitialized members Created 8 years, 1 month 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 | « dbus/signal_sender_verification_unittest.cc ('k') | dbus/test_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/test_service.h
diff --git a/dbus/test_service.h b/dbus/test_service.h
index 17f27ca133aa01c3700425748889d0b5892594fc..30f82164e423f7e0db4cfc327dbd541147c0b213 100644
--- a/dbus/test_service.h
+++ b/dbus/test_service.h
@@ -66,7 +66,12 @@ class TestService : public base::Thread {
void SendTestSignalFromRoot(const std::string& message);
// Request the ownership of a well-known name "TestService".
- void RequestOwnership();
+ // |callback| will be called with the result when an ownership request is
+ // completed.
+ void RequestOwnership(base::Callback<void(bool)> callback);
+
+ // Returns whether this instance has the name ownership or not.
+ bool has_ownership() const { return has_ownership_; }
private:
// Helper function for SendTestSignal().
@@ -79,7 +84,12 @@ class TestService : public base::Thread {
void ShutdownAndBlockInternal();
// Called when an ownership request is completed.
- void OnOwnership(const std::string& service_name,
+ // |callback| is the callback to be called with the result. |service_name| is
+ // the requested well-known bus name. |callback| and |service_name| are bound
+ // when the service requests the ownership. |success| is the result of the
+ // completed request, and is propagated to |callback|.
+ void OnOwnership(base::Callback<void(bool)> callback,
+ const std::string& service_name,
bool success);
// Called when a method is exported.
@@ -131,13 +141,16 @@ class TestService : public base::Thread {
void SendPropertyChangedSignalInternal(const std::string& name);
// Helper function for RequestOwnership().
- void RequestOwnershipInternal();
+ void RequestOwnershipInternal(base::Callback<void(bool)> callback);
scoped_refptr<base::MessageLoopProxy> dbus_thread_message_loop_proxy_;
base::WaitableEvent on_all_methods_exported_;
// The number of methods actually exported.
int num_exported_methods_;
+ // True iff this instance has successfully acquired the name ownership.
+ bool has_ownership_;
+
scoped_refptr<Bus> bus_;
ExportedObject* exported_object_;
};
« no previous file with comments | « dbus/signal_sender_verification_unittest.cc ('k') | dbus/test_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698