OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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 | 4 |
5 #include "base/debug/activity_tracker.h" | 5 #include "base/debug/activity_tracker.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 ASSERT_TRUE(tracker->Snapshot(&snapshot)); | 169 ASSERT_TRUE(tracker->Snapshot(&snapshot)); |
170 ASSERT_EQ(0U, snapshot.activity_stack_depth); | 170 ASSERT_EQ(0U, snapshot.activity_stack_depth); |
171 ASSERT_EQ(0U, snapshot.activity_stack.size()); | 171 ASSERT_EQ(0U, snapshot.activity_stack.size()); |
172 } | 172 } |
173 | 173 |
174 TEST_F(ActivityTrackerTest, CreateWithFileTest) { | 174 TEST_F(ActivityTrackerTest, CreateWithFileTest) { |
175 const char temp_name[] = "CreateWithFileTest"; | 175 const char temp_name[] = "CreateWithFileTest"; |
176 ScopedTempDir temp_dir; | 176 ScopedTempDir temp_dir; |
177 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 177 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
178 FilePath temp_file = temp_dir.path().AppendASCII(temp_name); | 178 FilePath temp_file = temp_dir.GetPath().AppendASCII(temp_name); |
179 const size_t temp_size = 64 << 10; // 64 KiB | 179 const size_t temp_size = 64 << 10; // 64 KiB |
180 | 180 |
181 // Create a global tracker on a new file. | 181 // Create a global tracker on a new file. |
182 ASSERT_FALSE(PathExists(temp_file)); | 182 ASSERT_FALSE(PathExists(temp_file)); |
183 GlobalActivityTracker::CreateWithFile(temp_file, temp_size, 0, "foo", 3); | 183 GlobalActivityTracker::CreateWithFile(temp_file, temp_size, 0, "foo", 3); |
184 GlobalActivityTracker* global = GlobalActivityTracker::Get(); | 184 GlobalActivityTracker* global = GlobalActivityTracker::Get(); |
185 EXPECT_EQ(std::string("foo"), global->allocator()->Name()); | 185 EXPECT_EQ(std::string("foo"), global->allocator()->Name()); |
186 global->ReleaseTrackerForCurrentThreadForTesting(); | 186 global->ReleaseTrackerForCurrentThreadForTesting(); |
187 delete global; | 187 delete global; |
188 | 188 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 EXPECT_EQ(starting_inactive, GetGlobalInactiveTrackerCount()); | 281 EXPECT_EQ(starting_inactive, GetGlobalInactiveTrackerCount()); |
282 | 282 |
283 t2.Exit(); | 283 t2.Exit(); |
284 t2.Join(); | 284 t2.Join(); |
285 EXPECT_EQ(starting_active, GetGlobalActiveTrackerCount()); | 285 EXPECT_EQ(starting_active, GetGlobalActiveTrackerCount()); |
286 EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount()); | 286 EXPECT_EQ(starting_inactive + 1, GetGlobalInactiveTrackerCount()); |
287 } | 287 } |
288 | 288 |
289 } // namespace debug | 289 } // namespace debug |
290 } // namespace base | 290 } // namespace base |
OLD | NEW |