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

Side by Side Diff: chrome/browser/media_galleries/gallery_watch_manager_unittest.cc

Issue 2230203002: chrome: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed accidental components/ change 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 unified diff | Download patch
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 "chrome/browser/media_galleries/gallery_watch_manager.h" 5 #include "chrome/browser/media_galleries/gallery_watch_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 232
233 base::ScopedTempDir temp2; 233 base::ScopedTempDir temp2;
234 ASSERT_TRUE(temp2.CreateUniqueTempDir()); 234 ASSERT_TRUE(temp2.CreateUniqueTempDir());
235 MediaGalleryPrefId id2 = AddGallery(temp2.path()); 235 MediaGalleryPrefId id2 = AddGallery(temp2.path());
236 236
237 // Add first watch and test it was added correctly. 237 // Add first watch and test it was added correctly.
238 AddAndConfirmWatch(id1); 238 AddAndConfirmWatch(id1);
239 MediaGalleryPrefIdSet set1 = 239 MediaGalleryPrefIdSet set1 =
240 manager()->GetWatchSet(profile(), extension()->id()); 240 manager()->GetWatchSet(profile(), extension()->id());
241 EXPECT_EQ(1u, set1.size()); 241 EXPECT_EQ(1u, set1.size());
242 EXPECT_TRUE(ContainsKey(set1, id1)); 242 EXPECT_TRUE(base::ContainsKey(set1, id1));
243 243
244 // Test that the second watch was added correctly too. 244 // Test that the second watch was added correctly too.
245 AddAndConfirmWatch(id2); 245 AddAndConfirmWatch(id2);
246 MediaGalleryPrefIdSet set2 = 246 MediaGalleryPrefIdSet set2 =
247 manager()->GetWatchSet(profile(), extension()->id()); 247 manager()->GetWatchSet(profile(), extension()->id());
248 EXPECT_EQ(2u, set2.size()); 248 EXPECT_EQ(2u, set2.size());
249 EXPECT_TRUE(ContainsKey(set2, id1)); 249 EXPECT_TRUE(base::ContainsKey(set2, id1));
250 EXPECT_TRUE(ContainsKey(set2, id2)); 250 EXPECT_TRUE(base::ContainsKey(set2, id2));
251 251
252 // Remove first watch and test that the second is still in there. 252 // Remove first watch and test that the second is still in there.
253 manager()->RemoveWatch(profile(), extension()->id(), id1); 253 manager()->RemoveWatch(profile(), extension()->id(), id1);
254 MediaGalleryPrefIdSet set3 = 254 MediaGalleryPrefIdSet set3 =
255 manager()->GetWatchSet(profile(), extension()->id()); 255 manager()->GetWatchSet(profile(), extension()->id());
256 EXPECT_EQ(1u, set3.size()); 256 EXPECT_EQ(1u, set3.size());
257 EXPECT_TRUE(ContainsKey(set3, id2)); 257 EXPECT_TRUE(base::ContainsKey(set3, id2));
258 258
259 // Try removing the first watch again and test that it has no effect. 259 // Try removing the first watch again and test that it has no effect.
260 manager()->RemoveWatch(profile(), extension()->id(), id1); 260 manager()->RemoveWatch(profile(), extension()->id(), id1);
261 EXPECT_EQ(1u, manager()->GetWatchSet(profile(), extension()->id()).size()); 261 EXPECT_EQ(1u, manager()->GetWatchSet(profile(), extension()->id()).size());
262 262
263 // Remove the second watch and test that the new watch set is empty. 263 // Remove the second watch and test that the new watch set is empty.
264 manager()->RemoveWatch(profile(), extension()->id(), id2); 264 manager()->RemoveWatch(profile(), extension()->id(), id2);
265 EXPECT_TRUE(manager()->GetWatchSet(profile(), extension()->id()).empty()); 265 EXPECT_TRUE(manager()->GetWatchSet(profile(), extension()->id()).empty());
266 } 266 }
267 267
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 ShutdownProfile(); 399 ShutdownProfile();
400 400
401 // Trigger a removable storage event that should be ignored now that the 401 // Trigger a removable storage event that should be ignored now that the
402 // profile has been destroyed to catch regressions. crbug.com/467627 402 // profile has been destroyed to catch regressions. crbug.com/467627
403 base::RunLoop run_loop; 403 base::RunLoop run_loop;
404 storage_monitor()->receiver()->ProcessDetach(storage_info.device_id()); 404 storage_monitor()->receiver()->ProcessDetach(storage_info.device_id());
405 run_loop.RunUntilIdle(); 405 run_loop.RunUntilIdle();
406 } 406 }
407 407
408 } // namespace component_updater 408 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698