Lines Matching refs:self
28 def CreateTmpFile(self, contents): argument
29 fd, self._tmp_file_name = tempfile.mkstemp()
32 return self._tmp_file_name
34 def tearDown(self): argument
35 if self._tmp_file_name:
37 os.unlink(self._tmp_file_name)
86 def test_version10_valid(self): argument
87 heap = self.CreateTmpFile(self._heap_num_field_valid_version10 + self._map_data)
88 self.assertTrue(native_heapdump_viewer.GetNumFieldValid(heap))
90 def test_version10_invalid(self): argument
91 heap = self.CreateTmpFile(self._heap_num_field_invalid_version10 + self._map_data)
92 self.assertFalse(native_heapdump_viewer.GetNumFieldValid(heap))
94 def test_version11_valid(self): argument
95 heap = self.CreateTmpFile("Android Native Heap Dump v1.1" + self._heap_data + self._map_data)
96 self.assertTrue(native_heapdump_viewer.GetNumFieldValid(heap))
98 def test_version12_valid(self): argument
99 heap = self.CreateTmpFile("Android Native Heap Dump v1.2" + self._heap_data + self._map_data)
100 self.assertTrue(native_heapdump_viewer.GetNumFieldValid(heap))
109 def test_backtrace_num_field_valid(self): argument
110 heap = self.CreateTmpFile(self._backtrace_data)
112 self.assertTrue(backtraces)
113 self.assertEqual(2, len(backtraces))
115 self.assertFalse(backtraces[0].is_zygote)
116 self.assertEqual(1000, backtraces[0].size)
117 self.assertEqual(4, backtraces[0].num_allocs)
118 self.assertEqual([0x1000, 0x2000, 0x3000], backtraces[0].frames)
120 self.assertTrue(backtraces[1].is_zygote)
121 self.assertEqual(8300, backtraces[1].size)
122 self.assertEqual(5, backtraces[1].num_allocs)
123 self.assertEqual([0x1300, 0x2300, 0x3300], backtraces[1].frames)
125 def test_backtrace_num_field_invalid(self): argument
126 heap = self.CreateTmpFile(self._backtrace_data)
128 self.assertTrue(backtraces)
129 self.assertEqual(2, len(backtraces))
131 self.assertFalse(backtraces[0].is_zygote)
132 self.assertEqual(1000, backtraces[0].size)
133 self.assertEqual(1, backtraces[0].num_allocs)
134 self.assertEqual([0x1000, 0x2000, 0x3000], backtraces[0].frames)
136 self.assertTrue(backtraces[1].is_zygote)
137 self.assertEqual(8300, backtraces[1].size)
138 self.assertEqual(1, backtraces[1].num_allocs)
139 self.assertEqual([0x1300, 0x2300, 0x3300], backtraces[1].frames)
141 def test_backtrace_reverse_field_valid(self): argument
142 heap = self.CreateTmpFile(self._backtrace_data)
144 self.assertTrue(backtraces)
145 self.assertEqual(2, len(backtraces))
147 self.assertFalse(backtraces[0].is_zygote)
148 self.assertEqual(1000, backtraces[0].size)
149 self.assertEqual(4, backtraces[0].num_allocs)
150 self.assertEqual([0x3000, 0x2000, 0x1000], backtraces[0].frames)
152 self.assertTrue(backtraces[1].is_zygote)
153 self.assertEqual(8300, backtraces[1].size)
154 self.assertEqual(5, backtraces[1].num_allocs)
155 self.assertEqual([0x3300, 0x2300, 0x1300], backtraces[1].frames)
157 def test_mappings(self): argument
166 heap = self.CreateTmpFile(map_data)
169 self.assertTrue(mappings)
170 self.assertEqual(2, len(mappings))
172 self.assertEqual(0x1000, mappings[0].start)
173 self.assertEqual(0x4000, mappings[0].end)
174 self.assertEqual(0, mappings[0].offset)
175 self.assertEqual("/system/lib64/libc.so", mappings[0].name)
177 self.assertEqual(0xa000, mappings[1].start)
178 self.assertEqual(0xf000, mappings[1].end)
179 self.assertEqual(0xb000, mappings[1].offset)
180 self.assertEqual("/system/lib64/libutils.so", mappings[1].name)