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

Side by Side Diff: device/hid/hid_service_unittest.cc

Issue 464753002: Fix HidService lifetime issues. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <vector> 5 #include <vector>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "device/hid/hid_service.h" 9 #include "device/hid/hid_service.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace device { 12 namespace device {
13 13
14 TEST(HidServiceTest, Create) { 14 TEST(HidServiceTest, Create) {
15 base::MessageLoopForIO message_loop; 15 base::MessageLoopForIO message_loop;
16 scoped_ptr<HidService> service( 16 HidService* service = HidService::GetInstance(
17 HidService::Create(message_loop.message_loop_proxy())); 17 message_loop.message_loop_proxy());
18 ASSERT_TRUE(service); 18 ASSERT_TRUE(service);
19 19
20 std::vector<HidDeviceInfo> devices; 20 std::vector<HidDeviceInfo> devices;
21 service->GetDevices(&devices); 21 service->GetDevices(&devices);
22 for (std::vector<HidDeviceInfo>::iterator it = devices.begin(); 22 for (std::vector<HidDeviceInfo>::iterator it = devices.begin();
23 it != devices.end(); 23 it != devices.end();
24 ++it) { 24 ++it) {
25 ASSERT_TRUE(it->device_id != kInvalidHidDeviceId); 25 ASSERT_TRUE(it->device_id != kInvalidHidDeviceId);
26 } 26 }
27 } 27 }
28 28
29 } // namespace device 29 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698