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

Side by Side Diff: device/devices_app/usb/device_manager_impl_unittest.cc

Issue 1342663003: Pass full Mojo USB DeviceInfo object with removal notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const base::Closure& continuation, 119 const base::Closure& continuation,
120 DeviceChangeNotificationPtr results) { 120 DeviceChangeNotificationPtr results) {
121 EXPECT_EQ(expected_added_guids.size(), results->devices_added.size()); 121 EXPECT_EQ(expected_added_guids.size(), results->devices_added.size());
122 std::set<std::string> actual_added_guids; 122 std::set<std::string> actual_added_guids;
123 for (size_t i = 0; i < results->devices_added.size(); ++i) 123 for (size_t i = 0; i < results->devices_added.size(); ++i)
124 actual_added_guids.insert(results->devices_added[i]->guid); 124 actual_added_guids.insert(results->devices_added[i]->guid);
125 EXPECT_EQ(expected_added_guids, actual_added_guids); 125 EXPECT_EQ(expected_added_guids, actual_added_guids);
126 EXPECT_EQ(expected_removed_guids.size(), results->devices_removed.size()); 126 EXPECT_EQ(expected_removed_guids.size(), results->devices_removed.size());
127 std::set<std::string> actual_removed_guids; 127 std::set<std::string> actual_removed_guids;
128 for (size_t i = 0; i < results->devices_removed.size(); ++i) 128 for (size_t i = 0; i < results->devices_removed.size(); ++i)
129 actual_removed_guids.insert(results->devices_removed[i]); 129 actual_removed_guids.insert(results->devices_removed[i]->guid);
130 EXPECT_EQ(expected_removed_guids, actual_removed_guids); 130 EXPECT_EQ(expected_removed_guids, actual_removed_guids);
131 continuation.Run(); 131 continuation.Run();
132 } 132 }
133 133
134 void ExpectDeviceInfoAndThen(const std::string& expected_guid, 134 void ExpectDeviceInfoAndThen(const std::string& expected_guid,
135 const base::Closure& continuation, 135 const base::Closure& continuation,
136 DeviceInfoPtr device_info) { 136 DeviceInfoPtr device_info) {
137 EXPECT_EQ(expected_guid, device_info->guid); 137 EXPECT_EQ(expected_guid, device_info->guid);
138 continuation.Run(); 138 continuation.Run();
139 } 139 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 base::RunLoop loop; 282 base::RunLoop loop;
283 device_manager->GetDeviceChanges(base::Bind(&ExpectDeviceChangesAndThen, 283 device_manager->GetDeviceChanges(base::Bind(&ExpectDeviceChangesAndThen,
284 added_guids, removed_guids, 284 added_guids, removed_guids,
285 loop.QuitClosure())); 285 loop.QuitClosure()));
286 loop.Run(); 286 loop.Run();
287 } 287 }
288 } 288 }
289 289
290 } // namespace usb 290 } // namespace usb
291 } // namespace device 291 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698