| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chromecast/crash/linux/synchronized_minidump_manager.h" | 5 #include "chromecast/crash/linux/synchronized_minidump_manager.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdio.h> // perror | 9 #include <stdio.h> // perror |
| 10 #include <stdlib.h> | 10 #include <stdlib.h> |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 class SynchronizedMinidumpManagerTest : public testing::Test { | 141 class SynchronizedMinidumpManagerTest : public testing::Test { |
| 142 public: | 142 public: |
| 143 SynchronizedMinidumpManagerTest() {} | 143 SynchronizedMinidumpManagerTest() {} |
| 144 ~SynchronizedMinidumpManagerTest() override {} | 144 ~SynchronizedMinidumpManagerTest() override {} |
| 145 | 145 |
| 146 void SetUp() override { | 146 void SetUp() override { |
| 147 // Set up a temporary directory which will be used as our fake home dir. | 147 // Set up a temporary directory which will be used as our fake home dir. |
| 148 ASSERT_TRUE(fake_home_dir_.CreateUniqueTempDir()); | 148 ASSERT_TRUE(fake_home_dir_.CreateUniqueTempDir()); |
| 149 path_override_.reset( | 149 path_override_.reset( |
| 150 new base::ScopedPathOverride(base::DIR_HOME, fake_home_dir_.path())); | 150 new base::ScopedPathOverride(base::DIR_HOME, fake_home_dir_.GetPath())); |
| 151 | 151 |
| 152 minidump_dir_ = fake_home_dir_.path().Append(kMinidumpSubdir); | 152 minidump_dir_ = fake_home_dir_.GetPath().Append(kMinidumpSubdir); |
| 153 lockfile_ = minidump_dir_.Append(kLockfileName); | 153 lockfile_ = minidump_dir_.Append(kLockfileName); |
| 154 metadata_ = minidump_dir_.Append(kMetadataName); | 154 metadata_ = minidump_dir_.Append(kMetadataName); |
| 155 | 155 |
| 156 // Create a minidump directory. | 156 // Create a minidump directory. |
| 157 ASSERT_TRUE(base::CreateDirectory(minidump_dir_)); | 157 ASSERT_TRUE(base::CreateDirectory(minidump_dir_)); |
| 158 ASSERT_TRUE(base::IsDirectoryEmpty(minidump_dir_)); | 158 ASSERT_TRUE(base::IsDirectoryEmpty(minidump_dir_)); |
| 159 | 159 |
| 160 // Create a lockfile in that directory. | 160 // Create a lockfile in that directory. |
| 161 base::File lockfile( | 161 base::File lockfile( |
| 162 lockfile_, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); | 162 lockfile_, base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 const base::FilePath path = | 495 const base::FilePath path = |
| 496 base::FilePath(manager.dump_path()).Append("hello123"); | 496 base::FilePath(manager.dump_path()).Append("hello123"); |
| 497 const char kFileContents[] = "foobar"; | 497 const char kFileContents[] = "foobar"; |
| 498 ASSERT_EQ(static_cast<int>(sizeof(kFileContents)), | 498 ASSERT_EQ(static_cast<int>(sizeof(kFileContents)), |
| 499 WriteFile(path, kFileContents, sizeof(kFileContents))); | 499 WriteFile(path, kFileContents, sizeof(kFileContents))); |
| 500 | 500 |
| 501 ASSERT_TRUE(manager.HasDumps()); | 501 ASSERT_TRUE(manager.HasDumps()); |
| 502 } | 502 } |
| 503 | 503 |
| 504 } // namespace chromecast | 504 } // namespace chromecast |
| OLD | NEW |