@@ -21,45 +21,44 @@ using namespace lldb;
21
21
using namespace lldb_private ;
22
22
23
23
class ProgressReportTest : public ::testing::Test {
24
- SubsystemRAII<FileSystem, HostInfo, PlatformMacOSX> subsystems;
25
-
26
- // The debugger's initialization function can't be called with no arguments
27
- // so calling it using SubsystemRAII will cause the test build to fail as
28
- // SubsystemRAII will call Initialize with no arguments. As such we set it up
29
- // here the usual way.
30
- void SetUp () override { Debugger::Initialize (nullptr ); }
31
- void TearDown () override { Debugger::Terminate (); }
24
+ SubsystemRAII<FileSystem, HostInfo, PlatformMacOSX> subsystems;
25
+
26
+ // The debugger's initialization function can't be called with no arguments
27
+ // so calling it using SubsystemRAII will cause the test build to fail as
28
+ // SubsystemRAII will call Initialize with no arguments. As such we set it up
29
+ // here the usual way.
30
+ void SetUp () override { Debugger::Initialize (nullptr ); }
31
+ void TearDown () override { Debugger::Terminate (); }
32
32
};
33
33
34
34
TEST_F (ProgressReportTest, TestReportCreation) {
35
35
std::chrono::milliseconds timeout (100 );
36
- const unsigned long long NO_TOTAL = 1 ;
37
36
38
- // Set up the debugger, make sure that was done properly
37
+ // Set up the debugger, make sure that was done properly.
39
38
ArchSpec arch (" x86_64-apple-macosx-" );
40
39
Platform::SetHostPlatform (PlatformRemoteMacOSX::CreateInstance (true , &arch));
41
40
42
41
DebuggerSP debugger_sp = Debugger::CreateInstance ();
43
42
ASSERT_TRUE (debugger_sp);
44
43
45
- // Get the debugger's broadcaster
44
+ // Get the debugger's broadcaster.
46
45
Broadcaster &broadcaster = debugger_sp->GetBroadcaster ();
47
46
48
47
// Create a listener, make sure it can receive events and that it's
49
- // listening to the correct broadcast bit
48
+ // listening to the correct broadcast bit.
50
49
ListenerSP listener_sp = Listener::MakeListener (" progress-listener" );
51
50
52
51
listener_sp->StartListeningForEvents (&broadcaster,
53
52
Debugger::eBroadcastBitProgress);
54
53
EXPECT_TRUE (
55
- broadcaster.EventTypeHasListeners (Debugger::eBroadcastBitProgress));
54
+ broadcaster.EventTypeHasListeners (Debugger::eBroadcastBitProgress));
56
55
57
56
EventSP event_sp;
58
57
const ProgressEventData *data;
59
58
60
- // Scope this for RAII on the progress objects
59
+ // Scope this for RAII on the progress objects.
61
60
// Create progress reports and check that their respective events for having
62
- // started are broadcasted
61
+ // started and ended are broadcasted.
63
62
{
64
63
Progress progress1 (" Progress report 1" , " Starting report 1" );
65
64
Progress progress2 (" Progress report 2" , " Starting report 2" );
@@ -76,7 +75,7 @@ TEST_F(ProgressReportTest, TestReportCreation) {
76
75
ASSERT_EQ (data->GetDetails (), " Starting report 1" );
77
76
ASSERT_FALSE (data->IsFinite ());
78
77
ASSERT_FALSE (data->GetCompleted ());
79
- ASSERT_EQ (data->GetTotal (), NO_TOTAL );
78
+ ASSERT_EQ (data->GetTotal (), Progress:: kNonDeterministicTotal );
80
79
ASSERT_EQ (data->GetMessage (), " Progress report 1: Starting report 1" );
81
80
82
81
EXPECT_TRUE (listener_sp->GetEvent (event_sp, timeout));
@@ -85,20 +84,20 @@ TEST_F(ProgressReportTest, TestReportCreation) {
85
84
ASSERT_EQ (data->GetDetails (), " Starting report 2" );
86
85
ASSERT_FALSE (data->IsFinite ());
87
86
ASSERT_FALSE (data->GetCompleted ());
88
- ASSERT_EQ (data->GetTotal (), NO_TOTAL );
87
+ ASSERT_EQ (data->GetTotal (), Progress:: kNonDeterministicTotal );
89
88
ASSERT_EQ (data->GetMessage (), " Progress report 2: Starting report 2" );
90
89
91
90
EXPECT_TRUE (listener_sp->GetEvent (event_sp, timeout));
92
91
data = ProgressEventData::GetEventDataFromEvent (event_sp.get ());
93
92
ASSERT_EQ (data->GetDetails (), " Starting report 3" );
94
93
ASSERT_FALSE (data->IsFinite ());
95
94
ASSERT_FALSE (data->GetCompleted ());
96
- ASSERT_EQ (data->GetTotal (), NO_TOTAL );
95
+ ASSERT_EQ (data->GetTotal (), Progress:: kNonDeterministicTotal );
97
96
ASSERT_EQ (data->GetMessage (), " Progress report 3: Starting report 3" );
98
97
99
98
// Progress report objects should be destroyed at this point so
100
99
// get each report from the queue and check that they've been
101
- // destroyed in reverse order
100
+ // destroyed in reverse order.
102
101
EXPECT_TRUE (listener_sp->GetEvent (event_sp, timeout));
103
102
data = ProgressEventData::GetEventDataFromEvent (event_sp.get ());
104
103
0 commit comments