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

Unified Diff: dbus/object_proxy_unittest.cc

Issue 1559873005: dbus: Use randomly generated string as a TestService's service name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « dbus/object_manager_unittest.cc ('k') | dbus/property_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/object_proxy_unittest.cc
diff --git a/dbus/object_proxy_unittest.cc b/dbus/object_proxy_unittest.cc
index 22130b64bc343352eedd633872d545dd44c01489..05c1294349688978359ff7675bab848441c6c61d 100644
--- a/dbus/object_proxy_unittest.cc
+++ b/dbus/object_proxy_unittest.cc
@@ -20,16 +20,12 @@ class ObjectProxyTest : public testing::Test {
bus_options.bus_type = Bus::SESSION;
bus_options.connection_type = Bus::PRIVATE;
bus_ = new Bus(bus_options);
-
- object_proxy_ = bus_->GetObjectProxy(
- "org.chromium.TestService", ObjectPath("/org/chromium/TestObject"));
}
void TearDown() override { bus_->ShutdownAndBlock(); }
base::MessageLoopForIO message_loop_;
scoped_refptr<Bus> bus_;
- ObjectProxy* object_proxy_;
};
// Used as a WaitForServiceToBeAvailableCallback.
@@ -43,14 +39,17 @@ void OnServiceIsAvailable(scoped_ptr<base::RunLoop>* run_loop,
TEST_F(ObjectProxyTest, WaitForServiceToBeAvailable) {
scoped_ptr<base::RunLoop> run_loop;
+ TestService::Options options;
+ TestService test_service(options);
+
// Callback is not yet called because the service is not available.
- object_proxy_->WaitForServiceToBeAvailable(
+ ObjectProxy* object_proxy = bus_->GetObjectProxy(
+ test_service.service_name(), ObjectPath("/org/chromium/TestObject"));
+ object_proxy->WaitForServiceToBeAvailable(
base::Bind(&OnServiceIsAvailable, &run_loop));
base::RunLoop().RunUntilIdle();
// Start the service.
- TestService::Options options;
- TestService test_service(options);
ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted());
ASSERT_TRUE(test_service.has_ownership());
@@ -61,7 +60,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailable) {
// Callback is called because the service is already available.
run_loop.reset(new base::RunLoop);
- object_proxy_->WaitForServiceToBeAvailable(
+ object_proxy->WaitForServiceToBeAvailable(
base::Bind(&OnServiceIsAvailable, &run_loop));
run_loop->Run();
« no previous file with comments | « dbus/object_manager_unittest.cc ('k') | dbus/property_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698