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

Unified Diff: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc

Issue 2275173002: Add unit test for BluetoothChooserController (Closed)
Patch Set: added unit test for BluetoothChooserController Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
index 7f877bf6f4caab43e47c388910232fd4f8e3417c..14ccb0b25fda411030aacb811b1e4432e0fc98b2 100644
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_controller.cc
@@ -234,6 +234,7 @@ void BluetoothChooserController::RemoveDevice(const std::string& device_id) {
});
if (device_it != devices_.end()) {
+ size_t index = device_it - devices_.begin();
Jeffrey Yasskin 2016/08/26 21:46:12 Why did this move back?
juncai 2016/08/27 00:21:30 The previous one works in release code, but debug
Jeffrey Yasskin 2016/08/27 00:35:45 Oops, you're totally right. The .erase() invalidat
juncai 2016/08/27 02:15:56 Acknowledged.
devices_.erase(device_it);
const auto& it = device_name_counts_.find(name_it->second);
@@ -246,7 +247,7 @@ void BluetoothChooserController::RemoveDevice(const std::string& device_id) {
device_id_to_name_map_.erase(name_it);
if (view())
- view()->OnOptionRemoved(device_it - devices_.begin());
+ view()->OnOptionRemoved(index);
}
}

Powered by Google App Engine
This is Rietveld 408576698