Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: base/debug/activity_tracker_unittest.cc

Issue 2275553005: //base: Make ScopedTempDir::path() a GetPath() with a DCHECK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/files/dir_reader_posix_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | base/files/dir_reader_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698