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/quic_arena_scoped_ptr.h" |
5 | 5 |
6 #include "net/quic/quic_one_block_arena.h" | 6 #include "net/quic/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 // #include "testing/base/public/gunit.h" | |
10 | 9 |
11 namespace net { | 10 namespace net { |
12 namespace { | 11 namespace { |
13 | 12 |
14 enum class TestParam { kFromHeap, kFromArena }; | 13 enum class TestParam { kFromHeap, kFromArena }; |
15 | 14 |
16 struct TestObject { | 15 struct TestObject { |
17 explicit TestObject(uintptr_t value) : value(value) { buffer.resize(1024); } | 16 explicit TestObject(uintptr_t value) : value(value) { buffer.resize(1024); } |
18 uintptr_t value; | 17 uintptr_t value; |
19 | 18 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 TEST_P(QuicArenaScopedPtrParamTest, Swap) { | 93 TEST_P(QuicArenaScopedPtrParamTest, Swap) { |
95 QuicArenaScopedPtr<TestObject> ptr1 = CreateObject(12345); | 94 QuicArenaScopedPtr<TestObject> ptr1 = CreateObject(12345); |
96 QuicArenaScopedPtr<TestObject> ptr2 = CreateObject(54321); | 95 QuicArenaScopedPtr<TestObject> ptr2 = CreateObject(54321); |
97 ptr1.swap(ptr2); | 96 ptr1.swap(ptr2); |
98 EXPECT_EQ(12345u, ptr2->value); | 97 EXPECT_EQ(12345u, ptr2->value); |
99 EXPECT_EQ(54321u, ptr1->value); | 98 EXPECT_EQ(54321u, ptr1->value); |
100 } | 99 } |
101 | 100 |
102 } // namespace | 101 } // namespace |
103 } // namespace net | 102 } // namespace net |
OLD | NEW |