OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "net/quic/quic_arena_scoped_ptr.h" | 4 #include "net/quic/core/quic_arena_scoped_ptr.h" |
5 | 5 |
6 #include "net/quic/quic_one_block_arena.h" | 6 #include "net/quic/core/quic_one_block_arena.h" |
7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 namespace { | 11 namespace { |
12 | 12 |
13 enum class TestParam { kFromHeap, kFromArena }; | 13 enum class TestParam { kFromHeap, kFromArena }; |
14 | 14 |
15 struct TestObject { | 15 struct TestObject { |
16 explicit TestObject(uintptr_t value) : value(value) { buffer.resize(1024); } | 16 explicit TestObject(uintptr_t value) : value(value) { buffer.resize(1024); } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 TEST_P(QuicArenaScopedPtrParamTest, Swap) { | 93 TEST_P(QuicArenaScopedPtrParamTest, Swap) { |
94 QuicArenaScopedPtr<TestObject> ptr1 = CreateObject(12345); | 94 QuicArenaScopedPtr<TestObject> ptr1 = CreateObject(12345); |
95 QuicArenaScopedPtr<TestObject> ptr2 = CreateObject(54321); | 95 QuicArenaScopedPtr<TestObject> ptr2 = CreateObject(54321); |
96 ptr1.swap(ptr2); | 96 ptr1.swap(ptr2); |
97 EXPECT_EQ(12345u, ptr2->value); | 97 EXPECT_EQ(12345u, ptr2->value); |
98 EXPECT_EQ(54321u, ptr1->value); | 98 EXPECT_EQ(54321u, ptr1->value); |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 } // namespace net | 102 } // namespace net |
OLD | NEW |