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

Side by Side Diff: base/id_map_unittest.cc

Issue 702843004: Transfer serviceworker state during cross site navigations too. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/id_map.h" 5 #include "base/id_map.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 map.Remove(id2); 47 map.Remove(id2);
48 EXPECT_TRUE(map.IsEmpty()); 48 EXPECT_TRUE(map.IsEmpty());
49 EXPECT_EQ(0U, map.size()); 49 EXPECT_EQ(0U, map.size());
50 50
51 map.AddWithID(&obj1, 1); 51 map.AddWithID(&obj1, 1);
52 map.AddWithID(&obj2, 2); 52 map.AddWithID(&obj2, 2);
53 EXPECT_EQ(&obj1, map.Lookup(1)); 53 EXPECT_EQ(&obj1, map.Lookup(1));
54 EXPECT_EQ(&obj2, map.Lookup(2)); 54 EXPECT_EQ(&obj2, map.Lookup(2));
55 55
56 EXPECT_EQ(&obj2, map.Replace(2, &obj1));
57 EXPECT_EQ(&obj1, map.Lookup(2));
58
56 EXPECT_EQ(0, map.iteration_depth()); 59 EXPECT_EQ(0, map.iteration_depth());
57 } 60 }
58 61
59 TEST(IDMapTest, IteratorRemainsValidWhenRemovingCurrentElement) { 62 TEST(IDMapTest, IteratorRemainsValidWhenRemovingCurrentElement) {
60 IDMap<TestObject> map; 63 IDMap<TestObject> map;
61 64
62 TestObject obj1; 65 TestObject obj1;
63 TestObject obj2; 66 TestObject obj2;
64 TestObject obj3; 67 TestObject obj3;
65 68
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 349
347 for (int i = 0; i < kCount; ++i) { 350 for (int i = 0; i < kCount; ++i) {
348 delete external_obj[i]; 351 delete external_obj[i];
349 } 352 }
350 353
351 EXPECT_EQ(external_del_count, kCount); 354 EXPECT_EQ(external_del_count, kCount);
352 EXPECT_EQ(owned_del_count, kCount); 355 EXPECT_EQ(owned_del_count, kCount);
353 } 356 }
354 357
355 } // namespace 358 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698