OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 <unistd.h> | 5 #include <unistd.h> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "crash-reporter/kernel_collector.h" | 9 #include "crash-reporter/kernel_collector.h" |
10 #include "crash-reporter/system_logging_mock.h" | 10 #include "crash-reporter/system_logging_mock.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // Make sure the preserved dump is now clear. | 128 // Make sure the preserved dump is now clear. |
129 std::string dump; | 129 std::string dump; |
130 ASSERT_TRUE(collector_.LoadPreservedDump(&dump)); | 130 ASSERT_TRUE(collector_.LoadPreservedDump(&dump)); |
131 ASSERT_EQ(KernelCollector::kClearingSequence, dump); | 131 ASSERT_EQ(KernelCollector::kClearingSequence, dump); |
132 } | 132 } |
133 | 133 |
134 TEST_F(KernelCollectorTest, CollectOptedOut) { | 134 TEST_F(KernelCollectorTest, CollectOptedOut) { |
135 SetUpSuccessfulCollect(); | 135 SetUpSuccessfulCollect(); |
136 s_metrics = false; | 136 s_metrics = false; |
137 ASSERT_TRUE(collector_.Collect()); | 137 ASSERT_TRUE(collector_.Collect()); |
138 ASSERT_NE(std::string::npos, logging_.log().find("(ignoring)")); | 138 ASSERT_NE(std::string::npos, logging_.log().find("(ignoring - no consent)")); |
139 ASSERT_EQ(0, s_crashes); | 139 ASSERT_EQ(0, s_crashes); |
140 | 140 |
141 CheckPreservedDumpClear(); | 141 CheckPreservedDumpClear(); |
142 } | 142 } |
143 | 143 |
144 TEST_F(KernelCollectorTest, CollectOK) { | 144 TEST_F(KernelCollectorTest, CollectOK) { |
145 SetUpSuccessfulCollect(); | 145 SetUpSuccessfulCollect(); |
146 ASSERT_TRUE(collector_.Collect()); | 146 ASSERT_TRUE(collector_.Collect()); |
147 ASSERT_EQ(1, s_crashes); | 147 ASSERT_EQ(1, s_crashes); |
148 ASSERT_NE(std::string::npos, logging_.log().find("(handling)")); | 148 ASSERT_NE(std::string::npos, logging_.log().find("(handling)")); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 false)); | 268 false)); |
269 EXPECT_EQ("kernel-0123456789012345678901234567890123456789-00000000", | 269 EXPECT_EQ("kernel-0123456789012345678901234567890123456789-00000000", |
270 signature); | 270 signature); |
271 | 271 |
272 } | 272 } |
273 | 273 |
274 int main(int argc, char **argv) { | 274 int main(int argc, char **argv) { |
275 ::testing::InitGoogleTest(&argc, argv); | 275 ::testing::InitGoogleTest(&argc, argv); |
276 return RUN_ALL_TESTS(); | 276 return RUN_ALL_TESTS(); |
277 } | 277 } |
OLD | NEW |