| OLD | NEW |
| 1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 ScopedFileHandle scoped_file_1k( | 80 ScopedFileHandle scoped_file_1k( |
| 81 LoggingOpenFileForWrite(report_1k.file_path, | 81 LoggingOpenFileForWrite(report_1k.file_path, |
| 82 FileWriteMode::kCreateOrFail, | 82 FileWriteMode::kCreateOrFail, |
| 83 FilePermissions::kOwnerOnly)); | 83 FilePermissions::kOwnerOnly)); |
| 84 ASSERT_TRUE(scoped_file_1k.is_valid()); | 84 ASSERT_TRUE(scoped_file_1k.is_valid()); |
| 85 | 85 |
| 86 std::string string; | 86 std::string string; |
| 87 for (int i = 0; i < 128; ++i) | 87 for (int i = 0; i < 128; ++i) |
| 88 string.push_back(static_cast<char>(i)); | 88 string.push_back(static_cast<char>(i)); |
| 89 | 89 |
| 90 for (int i = 0; i < 1024; i += string.size()) { | 90 for (size_t i = 0; i < 1024; i += string.size()) { |
| 91 ASSERT_TRUE(LoggingWriteFile(scoped_file_1k.get(), | 91 ASSERT_TRUE(LoggingWriteFile(scoped_file_1k.get(), |
| 92 string.c_str(), string.length())); | 92 string.c_str(), string.length())); |
| 93 } | 93 } |
| 94 | 94 |
| 95 ScopedFileHandle scoped_file_3k( | 95 ScopedFileHandle scoped_file_3k( |
| 96 LoggingOpenFileForWrite(report_3k.file_path, | 96 LoggingOpenFileForWrite(report_3k.file_path, |
| 97 FileWriteMode::kCreateOrFail, | 97 FileWriteMode::kCreateOrFail, |
| 98 FilePermissions::kOwnerOnly)); | 98 FilePermissions::kOwnerOnly)); |
| 99 ASSERT_TRUE(scoped_file_3k.is_valid()); | 99 ASSERT_TRUE(scoped_file_3k.is_valid()); |
| 100 | 100 |
| 101 for (int i = 0; i < 3072; i += string.size()) { | 101 for (size_t i = 0; i < 3072; i += string.size()) { |
| 102 ASSERT_TRUE(LoggingWriteFile(scoped_file_3k.get(), | 102 ASSERT_TRUE(LoggingWriteFile(scoped_file_3k.get(), |
| 103 string.c_str(), string.length())); | 103 string.c_str(), string.length())); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 { | 107 { |
| 108 DatabaseSizePruneCondition condition(1); | 108 DatabaseSizePruneCondition condition(1); |
| 109 EXPECT_FALSE(condition.ShouldPruneReport(report_1k)); | 109 EXPECT_FALSE(condition.ShouldPruneReport(report_1k)); |
| 110 EXPECT_TRUE(condition.ShouldPruneReport(report_1k)); | 110 EXPECT_TRUE(condition.ShouldPruneReport(report_1k)); |
| 111 } | 111 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 .WillOnce(Return(CrashReportDatabase::kNoError)); | 227 .WillOnce(Return(CrashReportDatabase::kNoError)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 StaticCondition delete_all(true); | 230 StaticCondition delete_all(true); |
| 231 PruneCrashReportDatabase(&db, &delete_all); | 231 PruneCrashReportDatabase(&db, &delete_all); |
| 232 } | 232 } |
| 233 | 233 |
| 234 } // namespace | 234 } // namespace |
| 235 } // namespace test | 235 } // namespace test |
| 236 } // namespace crashpad | 236 } // namespace crashpad |
| OLD | NEW |