|
5 | 5 |
|
6 | 6 |
|
7 | 7 | class SBProgressTestCase(TestBase): |
8 | | - def test_with_external_bit_set(self): |
9 | | - """Test SBProgress events are listened to when the external bit is set.""" |
10 | | - |
11 | | - progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg) |
12 | | - listener = lldb.SBListener("Test listener") |
13 | | - broadcaster = self.dbg.GetBroadcaster() |
14 | | - broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgress) |
15 | | - event = lldb.SBEvent() |
16 | | - |
17 | | - expected_string = "Test progress first increment" |
18 | | - progress.Increment(1, expected_string) |
19 | | - self.assertTrue(listener.PeekAtNextEvent(event)) |
20 | | - stream = lldb.SBStream() |
21 | | - event.GetDescription(stream) |
22 | | - self.assertIn(expected_string, stream.GetData()) |
23 | | - |
24 | | - def test_without_external_bit_set(self): |
25 | | - """Test SBProgress events are not listened to on the internal progress bit.""" |
26 | | - |
27 | | - progress = lldb.SBProgress("Test SBProgress", "Test progress", self.dbg) |
28 | | - listener = lldb.SBListener("Test listener") |
29 | | - broadcaster = self.dbg.GetBroadcaster() |
30 | | - broadcaster.AddListener(listener, lldb.eBroadcastBitProgress) |
31 | | - event = lldb.SBEvent() |
32 | | - |
33 | | - expected_string = "Test progress first increment" |
34 | | - progress.Increment(1, expected_string) |
35 | | - self.assertFalse(listener.PeekAtNextEvent(event)) |
36 | | - |
37 | 8 | def test_with_external_bit_set(self): |
38 | 9 | """Test SBProgress can handle null events.""" |
39 | 10 |
|
@@ -65,3 +36,17 @@ def test_with_external_bit_set(self): |
65 | 36 | stream = lldb.SBStream() |
66 | 37 | event.GetDescription(stream) |
67 | 38 | self.assertIn("Step 3", stream.GetData()) |
| 39 | + |
| 40 | + def test_progress_finalize(self): |
| 41 | + """Test SBProgress finalize sends the progressEnd event""" |
| 42 | + |
| 43 | + progress = lldb.SBProgress("Test SBProgress", "Test finalize", self.dbg) |
| 44 | + listener = lldb.SBListener("Test listener") |
| 45 | + broadcaster = self.dbg.GetBroadcaster() |
| 46 | + broadcaster.AddListener(listener, lldb.eBroadcastBitExternalProgressCategory) |
| 47 | + event = lldb.SBEvent() |
| 48 | + progress.Finalize() |
| 49 | + self.assertTrue(listener.WaitForEvent(5, event)) |
| 50 | + stream = lldb.SBStream() |
| 51 | + event.GetDescription(stream) |
| 52 | + self.assertIn("type = end", stream.GetData()) |
0 commit comments