use of com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter in project binnavi by google.
the class CSearchWaiterTest method testSuccess.
@Test
public void testSuccess() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 0, new CAddress(0x300)));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNotNull(waiter.getReply());
assertTrue(waiter.getReply().success());
debugger.close();
}
use of com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter in project binnavi by google.
the class CSearchWaiterTest method testDetach.
@Test
public void testDetach() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new DetachReply(0, 0));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNull(waiter.getReply());
debugger.close();
}
use of com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter in project binnavi by google.
the class CSearchWaiterTest method testCloseRequested.
@Test
public void testCloseRequested() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
waiter.closeRequested();
Thread.sleep(250);
debugger.close();
assertFalse(waiter.isAlive());
assertNull(waiter.getReply());
}
use of com.google.security.zynamics.binnavi.Gui.Debug.MemoryPanel.Implementations.CSearchWaiter in project binnavi by google.
the class CSearchWaiterTest method testFailure.
@Test
public void testFailure() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CSearchWaiter waiter = new CSearchWaiter(debugger, new CAddress(0x300), 0x100, new byte[] { 10 });
waiter.start();
new Thread() {
@Override
public void run() {
try {
waiter.runExpensiveCommand();
} catch (final Exception e) {
}
}
}.start();
Thread.sleep(250);
debugger.connection.m_synchronizer.receivedEvent(new SearchReply(0, 3, null));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertNotNull(waiter.getReply());
assertFalse(waiter.getReply().success());
debugger.close();
}
Aggregations