OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <string> | 5 #include <string> |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 using sync_driver::DeviceInfoTracker; | 26 using sync_driver::DeviceInfoTracker; |
27 using testing::Return; | 27 using testing::Return; |
28 | 28 |
29 namespace extensions { | 29 namespace extensions { |
30 | 30 |
31 class MockDeviceInfoTracker : public DeviceInfoTracker { | 31 class MockDeviceInfoTracker : public DeviceInfoTracker { |
32 public: | 32 public: |
33 virtual ~MockDeviceInfoTracker() {} | 33 virtual ~MockDeviceInfoTracker() {} |
34 | 34 |
35 virtual scoped_ptr<DeviceInfo> GetDeviceInfo( | 35 virtual scoped_ptr<DeviceInfo> GetDeviceInfo( |
36 const std::string& client_id) const OVERRIDE { | 36 const std::string& client_id) const override { |
37 NOTREACHED(); | 37 NOTREACHED(); |
38 return scoped_ptr<DeviceInfo>(); | 38 return scoped_ptr<DeviceInfo>(); |
39 } | 39 } |
40 | 40 |
41 static DeviceInfo* CloneDeviceInfo(const DeviceInfo* device_info) { | 41 static DeviceInfo* CloneDeviceInfo(const DeviceInfo* device_info) { |
42 return new DeviceInfo(device_info->guid(), | 42 return new DeviceInfo(device_info->guid(), |
43 device_info->client_name(), | 43 device_info->client_name(), |
44 device_info->chrome_version(), | 44 device_info->chrome_version(), |
45 device_info->sync_user_agent(), | 45 device_info->sync_user_agent(), |
46 device_info->device_type(), | 46 device_info->device_type(), |
47 device_info->signin_scoped_device_id()); | 47 device_info->signin_scoped_device_id()); |
48 } | 48 } |
49 | 49 |
50 virtual ScopedVector<DeviceInfo> GetAllDeviceInfo() const OVERRIDE { | 50 virtual ScopedVector<DeviceInfo> GetAllDeviceInfo() const override { |
51 ScopedVector<DeviceInfo> list; | 51 ScopedVector<DeviceInfo> list; |
52 | 52 |
53 for (std::vector<const DeviceInfo*>::const_iterator iter = devices_.begin(); | 53 for (std::vector<const DeviceInfo*>::const_iterator iter = devices_.begin(); |
54 iter != devices_.end(); | 54 iter != devices_.end(); |
55 ++iter) { | 55 ++iter) { |
56 list.push_back(CloneDeviceInfo(*iter)); | 56 list.push_back(CloneDeviceInfo(*iter)); |
57 } | 57 } |
58 | 58 |
59 return list.Pass(); | 59 return list.Pass(); |
60 } | 60 } |
61 | 61 |
62 virtual void AddObserver(Observer* observer) OVERRIDE { NOTREACHED(); } | 62 virtual void AddObserver(Observer* observer) override { NOTREACHED(); } |
63 | 63 |
64 virtual void RemoveObserver(Observer* observer) OVERRIDE { NOTREACHED(); } | 64 virtual void RemoveObserver(Observer* observer) override { NOTREACHED(); } |
65 | 65 |
66 void Add(const DeviceInfo* device) { devices_.push_back(device); } | 66 void Add(const DeviceInfo* device) { devices_.push_back(device); } |
67 | 67 |
68 private: | 68 private: |
69 // DeviceInfo stored here are not owned. | 69 // DeviceInfo stored here are not owned. |
70 std::vector<const DeviceInfo*> devices_; | 70 std::vector<const DeviceInfo*> devices_; |
71 }; | 71 }; |
72 | 72 |
73 TEST(SignedInDevicesAPITest, GetSignedInDevices) { | 73 TEST(SignedInDevicesAPITest, GetSignedInDevices) { |
74 TestingProfile profile; | 74 TestingProfile profile; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 .WillOnce(Return((DeviceInfoTracker*)NULL)); | 241 .WillOnce(Return((DeviceInfoTracker*)NULL)); |
242 EXPECT_CALL(*pss_mock, Shutdown()); | 242 EXPECT_CALL(*pss_mock, Shutdown()); |
243 | 243 |
244 ScopedVector<DeviceInfo> output = GetAllSignedInDevices( | 244 ScopedVector<DeviceInfo> output = GetAllSignedInDevices( |
245 extension()->id(), profile()); | 245 extension()->id(), profile()); |
246 | 246 |
247 EXPECT_TRUE(output.empty()); | 247 EXPECT_TRUE(output.empty()); |
248 } | 248 } |
249 | 249 |
250 } // namespace extensions | 250 } // namespace extensions |
OLD | NEW |