| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 thread_number_ = thread_number; | 136 thread_number_ = thread_number; |
| 137 start_ = start; | 137 start_ = start; |
| 138 count_ = count; | 138 count_ = count; |
| 139 } | 139 } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 void ThreadMain() override { | 142 void ThreadMain() override { |
| 143 ThreadLogMessages thread_log_messages; | 143 ThreadLogMessages thread_log_messages; |
| 144 | 144 |
| 145 std::vector<std::string> expected_messages; | 145 std::vector<std::string> expected_messages; |
| 146 for (int index = start_; index <= start_ + count_; ++index) { | 146 for (int index = start_; index < start_ + count_; ++index) { |
| 147 std::string message = base::StringPrintf("message %d", index); | 147 std::string message = base::StringPrintf("message %d", index); |
| 148 expected_messages.push_back(message); | 148 expected_messages.push_back(message); |
| 149 LOG(WARNING) << message; | 149 LOG(WARNING) << message; |
| 150 } | 150 } |
| 151 | 151 |
| 152 const std::vector<std::string>& log_messages = | 152 const std::vector<std::string>& log_messages = |
| 153 thread_log_messages.log_messages(); | 153 thread_log_messages.log_messages(); |
| 154 | 154 |
| 155 ASSERT_EQ(expected_messages.size(), log_messages.size()); | 155 ASSERT_EQ(static_cast<size_t>(count_), log_messages.size()); |
| 156 for (size_t index = 0; index < log_messages.size(); ++index) { | 156 for (size_t index = 0; index < log_messages.size(); ++index) { |
| 157 EXPECT_EQ(expected_messages[index], MessageString(log_messages[index])) | 157 EXPECT_EQ(expected_messages[index], MessageString(log_messages[index])) |
| 158 << "thread_number_ " << thread_number_ << ", index " << index; | 158 << "thread_number_ " << thread_number_ << ", index " << index; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 size_t thread_number_; | 162 size_t thread_number_; |
| 163 int start_; | 163 int start_; |
| 164 int count_; | 164 int count_; |
| 165 | 165 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 for (LoggingTestThread& thread : threads) { | 183 for (LoggingTestThread& thread : threads) { |
| 184 thread.Join(); | 184 thread.Join(); |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 | 187 |
| 188 } // namespace | 188 } // namespace |
| 189 } // namespace test | 189 } // namespace test |
| 190 } // namespace crashpad | 190 } // namespace crashpad |
| OLD | NEW |