OLD | NEW |
1 // Copyright (c) 2012, Google Inc. | 1 // Copyright (c) 2012, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 | 29 |
30 // linux_core_dumper_unittest.cc: | 30 // linux_core_dumper_unittest.cc: |
31 // Unit tests for google_breakpad::LinuxCoreDumoer. | 31 // Unit tests for google_breakpad::LinuxCoreDumoer. |
32 | 32 |
| 33 #include <string> |
| 34 |
33 #include "breakpad_googletest_includes.h" | 35 #include "breakpad_googletest_includes.h" |
34 #include "client/linux/minidump_writer/linux_core_dumper.h" | 36 #include "client/linux/minidump_writer/linux_core_dumper.h" |
35 #include "common/linux/tests/crash_generator.h" | 37 #include "common/linux/tests/crash_generator.h" |
| 38 #include "common/using_std_string.h" |
36 | 39 |
37 using std::string; | |
38 using namespace google_breakpad; | 40 using namespace google_breakpad; |
39 | 41 |
40 TEST(LinuxCoreDumperTest, BuildProcPath) { | 42 TEST(LinuxCoreDumperTest, BuildProcPath) { |
41 const pid_t pid = getpid(); | 43 const pid_t pid = getpid(); |
42 const char procfs_path[] = "/procfs_copy"; | 44 const char procfs_path[] = "/procfs_copy"; |
43 LinuxCoreDumper dumper(getpid(), "core_file", procfs_path); | 45 LinuxCoreDumper dumper(getpid(), "core_file", procfs_path); |
44 | 46 |
45 char maps_path[NAME_MAX] = ""; | 47 char maps_path[NAME_MAX] = ""; |
46 char maps_path_expected[NAME_MAX]; | 48 char maps_path_expected[NAME_MAX]; |
47 snprintf(maps_path_expected, sizeof(maps_path_expected), | 49 snprintf(maps_path_expected, sizeof(maps_path_expected), |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_EQ(crash_generator.GetThreadId(kCrashThread), | 102 EXPECT_EQ(crash_generator.GetThreadId(kCrashThread), |
101 dumper.crash_thread()); | 103 dumper.crash_thread()); |
102 | 104 |
103 EXPECT_EQ(kNumOfThreads, dumper.threads().size()); | 105 EXPECT_EQ(kNumOfThreads, dumper.threads().size()); |
104 for (unsigned i = 0; i < kNumOfThreads; ++i) { | 106 for (unsigned i = 0; i < kNumOfThreads; ++i) { |
105 ThreadInfo info; | 107 ThreadInfo info; |
106 EXPECT_TRUE(dumper.GetThreadInfoByIndex(i, &info)); | 108 EXPECT_TRUE(dumper.GetThreadInfoByIndex(i, &info)); |
107 EXPECT_EQ(getpid(), info.ppid); | 109 EXPECT_EQ(getpid(), info.ppid); |
108 } | 110 } |
109 } | 111 } |
OLD | NEW |