<table><tr><td style="">sitter created this revision.<br />sitter added a reviewer: dfaure.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />sitter requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D24887">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This implements a simple expectation system covering slave commands.<br />
At its heart sits the CommandExpectation, which contains the expectations<br />
of a given command. Currently the sole expectation is about signal emission<br />
notably a whitelist of signals that any given command may emit during its<br />
emission. To assist this there's a new Signal enum which is used to<br />
refer to the signals. Signals by default are considered exclusive and<br />
repeatedly emitting the same signal will result in assertion failures.<br />
Multi-emission signals such as data/written/processedsize are of course<br />
excluded from this.<br />
All signal implementation in SlaveBase should call VERIFY_CALL to verify<br />
the validity of the signal call at call-time (notably: can this signal<br />
be called during this Command and may it be called 1 or N times).<br />
After the command finished the pre-existing verifyState function has<br />
been refitted for the new expectation tech.</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">slavebase.h now tries to document expectations WRT signals</li>
<li class="remarkup-list-item">makes KIO to a Q_NAMESPACE which kinda exposes unintended symbols I guess e.g. staticMetaObject. this does enable us to convert the enum values to strings via QMetaMethod but has no additional purpose beyond that.</li>
<li class="remarkup-list-item">m_state/States are no more. m_state was solely used to track whether error/finished was called and then assert expectations. this is replaced by m_receivedSignals which tracks any number of signals</li>
<li class="remarkup-list-item">verifyErrorFinishedNotCalled and verfifyFinishedNotCalled have been merged into verifyCall which is now the one-place-stop to get in-call verification (i.e signals call verifyCall and verifyCall makes sure that signal should even have been called)</li>
<li class="remarkup-list-item">verifyState has been reworked to be applicable to all expectations</li>
</ul>
<p>todo:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">I am not 100% on most of the expectations</li>
<li class="remarkup-list-item">do we really want Q_NAMESPACE on KIO? we could replace this with enumToString() functions switching over the values manually. seeing as I am lazy I'd rather use the moc generated data though</li>
<li class="remarkup-list-item">conceivably an empty expectation should mean everything is allowed, currently it's meant to mean nothing is allowed as that is rather more handy to make sure the expectations themselves are in fact correct and complete</li>
<li class="remarkup-list-item">warning todos</li>
<li class="remarkup-list-item">stray debugs</li>
</ul></div></div><br /><div><strong>TEST PLAN</strong><div><p>casually use all the slaves</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>BRANCH</strong><div><div>assert-file</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D24887">https://phabricator.kde.org/D24887</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/core/CMakeLists.txt<br />
src/core/commands_p.h<br />
src/core/slavebase.cpp<br />
src/core/slavebase.h</div></div></div><br /><div><strong>To: </strong>sitter, dfaure<br /><strong>Cc: </strong>kde-frameworks-devel, LeGast00n, GB_2, michaelh, ngraham, bruns<br /></div>