| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 bool deleted1 = false, deleted2 = false; | 553 bool deleted1 = false, deleted2 = false; |
| 554 | 554 |
| 555 typedef ListHashSet<OwnPtr<Dummy>> OwnPtrSet; | 555 typedef ListHashSet<OwnPtr<Dummy>> OwnPtrSet; |
| 556 OwnPtrSet set; | 556 OwnPtrSet set; |
| 557 | 557 |
| 558 Dummy* ptr1 = new Dummy(deleted1); | 558 Dummy* ptr1 = new Dummy(deleted1); |
| 559 { | 559 { |
| 560 // AddResult in a separate scope to avoid assertion hit, | 560 // AddResult in a separate scope to avoid assertion hit, |
| 561 // since we modify the container further. | 561 // since we modify the container further. |
| 562 OwnPtrSet::AddResult res1 = set.add(adoptPtr(ptr1)); | 562 OwnPtrSet::AddResult res1 = set.add(adoptPtr(ptr1)); |
| 563 EXPECT_EQ(res1.storedValue->m_value.get(), ptr1); | 563 EXPECT_EQ(res1.storedValue->get(), ptr1); |
| 564 } | 564 } |
| 565 | 565 |
| 566 EXPECT_FALSE(deleted1); | 566 EXPECT_FALSE(deleted1); |
| 567 EXPECT_EQ(1UL, set.size()); | 567 EXPECT_EQ(1UL, set.size()); |
| 568 OwnPtrSet::iterator it1 = set.find(ptr1); | 568 OwnPtrSet::iterator it1 = set.find(ptr1); |
| 569 EXPECT_NE(set.end(), it1); | 569 EXPECT_NE(set.end(), it1); |
| 570 EXPECT_EQ(ptr1, (*it1)); | 570 EXPECT_EQ(ptr1, (*it1)); |
| 571 | 571 |
| 572 Dummy* ptr2 = new Dummy(deleted2); | 572 Dummy* ptr2 = new Dummy(deleted2); |
| 573 { | 573 { |
| 574 OwnPtrSet::AddResult res2 = set.add(adoptPtr(ptr2)); | 574 OwnPtrSet::AddResult res2 = set.add(adoptPtr(ptr2)); |
| 575 EXPECT_EQ(res2.storedValue->m_value.get(), ptr2); | 575 EXPECT_EQ(res2.storedValue->get(), ptr2); |
| 576 } | 576 } |
| 577 | 577 |
| 578 EXPECT_FALSE(deleted2); | 578 EXPECT_FALSE(deleted2); |
| 579 EXPECT_EQ(2UL, set.size()); | 579 EXPECT_EQ(2UL, set.size()); |
| 580 OwnPtrSet::iterator it2 = set.find(ptr2); | 580 OwnPtrSet::iterator it2 = set.find(ptr2); |
| 581 EXPECT_NE(set.end(), it2); | 581 EXPECT_NE(set.end(), it2); |
| 582 EXPECT_EQ(ptr2, (*it2)); | 582 EXPECT_EQ(ptr2, (*it2)); |
| 583 | 583 |
| 584 set.remove(ptr1); | 584 set.remove(ptr1); |
| 585 EXPECT_TRUE(deleted1); | 585 EXPECT_TRUE(deleted1); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 692 |
| 693 Set other(set); | 693 Set other(set); |
| 694 counter = 0; | 694 counter = 0; |
| 695 set = std::move(other); | 695 set = std::move(other); |
| 696 EXPECT_EQ(0, counter); | 696 EXPECT_EQ(0, counter); |
| 697 } | 697 } |
| 698 | 698 |
| 699 } // anonymous namespace | 699 } // anonymous namespace |
| 700 | 700 |
| 701 } // namespace WTF | 701 } // namespace WTF |
| OLD | NEW |