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

Side by Side Diff: dbus/test_service.h

Issue 11358111: Make SignalSenderVerificationTest more robust (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DBUS_TEST_SERVICE_H_ 5 #ifndef DBUS_TEST_SERVICE_H_
6 #define DBUS_TEST_SERVICE_H_ 6 #define DBUS_TEST_SERVICE_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Returns true if the bus has the D-Bus thread. 58 // Returns true if the bus has the D-Bus thread.
59 bool HasDBusThread(); 59 bool HasDBusThread();
60 60
61 // Sends "Test" signal with the given message from the exported object. 61 // Sends "Test" signal with the given message from the exported object.
62 void SendTestSignal(const std::string& message); 62 void SendTestSignal(const std::string& message);
63 63
64 // Sends "Test" signal with the given message from the root object ("/"). 64 // Sends "Test" signal with the given message from the root object ("/").
65 // This function emulates dbus-send's behavior. 65 // This function emulates dbus-send's behavior.
66 void SendTestSignalFromRoot(const std::string& message); 66 void SendTestSignalFromRoot(const std::string& message);
67 67
68 // Request the ownership of a well-known name "TestService". 68 // Request the ownership of a well-known name "TestService".
satorux1 2012/11/07 01:42:25 Please add some comment about the new parameter.
Haruki Sato 2012/11/12 04:59:43 Done.
69 void RequestOwnership(); 69 void RequestOwnership(base::Callback<void(bool)>);
satorux1 2012/11/07 01:42:25 parameter name is missing.
Haruki Sato 2012/11/12 04:59:43 Done. Thanks.
70
71 // Returns whether this instance has the name ownership or not.
72 bool HasOwnership();
satorux1 2012/11/07 01:42:25 bool has_ownership() const { return has_ownership_
Haruki Sato 2012/11/12 04:59:43 Done.
70 73
71 private: 74 private:
72 // Helper function for SendTestSignal(). 75 // Helper function for SendTestSignal().
73 void SendTestSignalInternal(const std::string& message); 76 void SendTestSignalInternal(const std::string& message);
74 77
75 // Helper function for SendTestSignalFromRoot. 78 // Helper function for SendTestSignalFromRoot.
76 void SendTestSignalFromRootInternal(const std::string& message); 79 void SendTestSignalFromRootInternal(const std::string& message);
77 80
78 // Helper function for ShutdownAndBlock(). 81 // Helper function for ShutdownAndBlock().
79 void ShutdownAndBlockInternal(); 82 void ShutdownAndBlockInternal();
80 83
81 // Called when an ownership request is completed. 84 // Called when an ownership request is completed.
82 void OnOwnership(const std::string& service_name, 85 void OnOwnership(base::Callback<void(bool)> callback,
satorux1 2012/11/07 01:42:25 Please add some comment about the new parameter, a
Haruki Sato 2012/11/12 04:59:43 Done.
86 const std::string& service_name,
83 bool success); 87 bool success);
84 88
85 // Called when a method is exported. 89 // Called when a method is exported.
86 void OnExported(const std::string& interface_name, 90 void OnExported(const std::string& interface_name,
87 const std::string& method_name, 91 const std::string& method_name,
88 bool success); 92 bool success);
89 93
90 // base::Thread override. 94 // base::Thread override.
91 virtual void Run(MessageLoop* message_loop) OVERRIDE; 95 virtual void Run(MessageLoop* message_loop) OVERRIDE;
92 96
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void SetProperty(MethodCall* method_call, 128 void SetProperty(MethodCall* method_call,
125 dbus::ExportedObject::ResponseSender response_sender); 129 dbus::ExportedObject::ResponseSender response_sender);
126 130
127 // Sends a property changed signal for the name property. 131 // Sends a property changed signal for the name property.
128 void SendPropertyChangedSignal(const std::string& name); 132 void SendPropertyChangedSignal(const std::string& name);
129 133
130 // Helper function for SendPropertyChangedSignal(). 134 // Helper function for SendPropertyChangedSignal().
131 void SendPropertyChangedSignalInternal(const std::string& name); 135 void SendPropertyChangedSignalInternal(const std::string& name);
132 136
133 // Helper function for RequestOwnership(). 137 // Helper function for RequestOwnership().
134 void RequestOwnershipInternal(); 138 void RequestOwnershipInternal(base::Callback<void(bool)> callback);
135 139
136 scoped_refptr<base::MessageLoopProxy> dbus_thread_message_loop_proxy_; 140 scoped_refptr<base::MessageLoopProxy> dbus_thread_message_loop_proxy_;
137 base::WaitableEvent on_all_methods_exported_; 141 base::WaitableEvent on_all_methods_exported_;
138 // The number of methods actually exported. 142 // The number of methods actually exported.
139 int num_exported_methods_; 143 int num_exported_methods_;
140 144
145 // True iff this instance has successfully acquired the name ownership.
146 bool has_name_ownership;
satorux1 2012/11/07 01:42:25 The trailing _ is missing.
Haruki Sato 2012/11/12 04:59:43 Done.
147
141 scoped_refptr<Bus> bus_; 148 scoped_refptr<Bus> bus_;
142 ExportedObject* exported_object_; 149 ExportedObject* exported_object_;
143 }; 150 };
144 151
145 } // namespace dbus 152 } // namespace dbus
146 153
147 #endif // DBUS_TEST_SERVICE_H_ 154 #endif // DBUS_TEST_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698