LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2014 Google Inc. All Rights Reserved. | 1 // Copyright 2014 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 }; | 69 }; |
70 | 70 |
71 } // namespace | 71 } // namespace |
72 | 72 |
73 TEST(ShardedQuarantineTest, EvenLoading) { | 73 TEST(ShardedQuarantineTest, EvenLoading) { |
74 TestShardedQuarantine q; | 74 TestShardedQuarantine q; |
75 DummyObject d(1); | 75 DummyObject d(1); |
76 DummyObject popped; | 76 DummyObject popped; |
77 | 77 |
78 // No max object size. This logic is tested in SizeLimitedQuarantineImpl. | 78 // No max object size. This logic is tested in SizeLimitedQuarantineImpl. |
79 q.set_max_object_size(0); | 79 q.set_max_object_size(TestShardedQuarantine::kUnboundedSize); |
80 q.set_max_quarantine_size(10000); | 80 q.set_max_quarantine_size(10000); |
81 | 81 |
82 EXPECT_EQ(0u, q.size()); | 82 EXPECT_EQ(0u, q.size()); |
83 | 83 |
84 // Stuff a bunch of things into the quarantine, but don't saturate it. | 84 // Stuff a bunch of things into the quarantine, but don't saturate it. |
85 for (size_t i = 0; i < 9000; ++i) { | 85 for (size_t i = 0; i < 9000; ++i) { |
86 EXPECT_TRUE(q.Push(d)); | 86 EXPECT_TRUE(q.Push(d)); |
87 EXPECT_EQ(i + 1, q.size()); | 87 EXPECT_EQ(i + 1, q.size()); |
88 | 88 |
89 EXPECT_FALSE(q.Pop(&popped)); | 89 EXPECT_FALSE(q.Pop(&popped)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 EXPECT_EQ(old_count, os.size()); | 155 EXPECT_EQ(old_count, os.size()); |
156 size_t emptied_size = 0; | 156 size_t emptied_size = 0; |
157 for (size_t i = 0; i < os.size(); ++i) | 157 for (size_t i = 0; i < os.size(); ++i) |
158 emptied_size += os[i].size; | 158 emptied_size += os[i].size; |
159 EXPECT_EQ(old_size, emptied_size); | 159 EXPECT_EQ(old_size, emptied_size); |
160 } | 160 } |
161 | 161 |
162 } // namespace quarantines | 162 } // namespace quarantines |
163 } // namespace asan | 163 } // namespace asan |
164 } // namespace agent | 164 } // namespace agent |
LEFT | RIGHT |