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

Side by Side Diff: dbus/object_proxy_unittest.cc

Issue 1867253002: Convert //dbus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixes in //device Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « dbus/object_proxy.cc ('k') | dbus/property.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "dbus/bus.h" 8 #include "dbus/bus.h"
9 #include "dbus/object_proxy.h" 9 #include "dbus/object_proxy.h"
10 #include "dbus/test_service.h" 10 #include "dbus/test_service.h"
(...skipping 11 matching lines...) Expand all
22 bus_ = new Bus(bus_options); 22 bus_ = new Bus(bus_options);
23 } 23 }
24 24
25 void TearDown() override { bus_->ShutdownAndBlock(); } 25 void TearDown() override { bus_->ShutdownAndBlock(); }
26 26
27 base::MessageLoopForIO message_loop_; 27 base::MessageLoopForIO message_loop_;
28 scoped_refptr<Bus> bus_; 28 scoped_refptr<Bus> bus_;
29 }; 29 };
30 30
31 // Used as a WaitForServiceToBeAvailableCallback. 31 // Used as a WaitForServiceToBeAvailableCallback.
32 void OnServiceIsAvailable(scoped_ptr<base::RunLoop>* run_loop, 32 void OnServiceIsAvailable(std::unique_ptr<base::RunLoop>* run_loop,
33 bool service_is_available) { 33 bool service_is_available) {
34 EXPECT_TRUE(service_is_available); 34 EXPECT_TRUE(service_is_available);
35 ASSERT_TRUE(*run_loop); 35 ASSERT_TRUE(*run_loop);
36 (*run_loop)->Quit(); 36 (*run_loop)->Quit();
37 } 37 }
38 38
39 TEST_F(ObjectProxyTest, WaitForServiceToBeAvailable) { 39 TEST_F(ObjectProxyTest, WaitForServiceToBeAvailable) {
40 scoped_ptr<base::RunLoop> run_loop; 40 std::unique_ptr<base::RunLoop> run_loop;
41 41
42 TestService::Options options; 42 TestService::Options options;
43 TestService test_service(options); 43 TestService test_service(options);
44 44
45 // Callback is not yet called because the service is not available. 45 // Callback is not yet called because the service is not available.
46 ObjectProxy* object_proxy = bus_->GetObjectProxy( 46 ObjectProxy* object_proxy = bus_->GetObjectProxy(
47 test_service.service_name(), ObjectPath("/org/chromium/TestObject")); 47 test_service.service_name(), ObjectPath("/org/chromium/TestObject"));
48 object_proxy->WaitForServiceToBeAvailable( 48 object_proxy->WaitForServiceToBeAvailable(
49 base::Bind(&OnServiceIsAvailable, &run_loop)); 49 base::Bind(&OnServiceIsAvailable, &run_loop));
50 base::RunLoop().RunUntilIdle(); 50 base::RunLoop().RunUntilIdle();
(...skipping 13 matching lines...) Expand all
64 base::Bind(&OnServiceIsAvailable, &run_loop)); 64 base::Bind(&OnServiceIsAvailable, &run_loop));
65 run_loop->Run(); 65 run_loop->Run();
66 66
67 // Shut down the service. 67 // Shut down the service.
68 test_service.ShutdownAndBlock(); 68 test_service.ShutdownAndBlock();
69 test_service.Stop(); 69 test_service.Stop();
70 } 70 }
71 71
72 } // namespace 72 } // namespace
73 } // namespace dbus 73 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/object_proxy.cc ('k') | dbus/property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698