use of com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger in project binnavi by google.
the class CMemoryViewerSynchronizerTest method setUp.
@Before
public void setUp() {
final IGraphModel graphModel = new MockGraphModel();
m_model = new CDebugPerspectiveModel(graphModel);
final CMemoryProvider provider = new CMemoryProvider();
m_hexView.setData(provider);
m_synchronizer = new CMemoryViewerSynchronizer(m_hexView, provider, m_model);
m_debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
m_model.setActiveDebugger(m_debugger);
}
use of com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger in project binnavi by google.
the class CDumpAllWaiterTest method testFailure.
@Test
public void testFailure() throws Exception {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
final CDumpAllWaiter waiter = new CDumpAllWaiter(debugger, new CAddress(0x300), 0x100);
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 ReadMemoryReply(0, 3, null, null));
Thread.sleep(250);
assertFalse(waiter.isAlive());
assertFalse(waiter.success());
debugger.close();
}
use of com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger 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.Debug.Debugger.MockDebugger 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();
}
use of com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger in project binnavi by google.
the class CMemoryRefreshButtonSynchronizerTest method testThreads.
@Test
public void testThreads() throws DebugExceptionWrapper {
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.connect();
debugger.getProcessManager().setAttached(true);
final TargetProcessThread thread = new TargetProcessThread(1, ThreadState.RUNNING);
m_model.setActiveDebugger(debugger);
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().addThread(thread);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().setActiveThread(thread);
assertTrue(m_refreshButton.isEnabled());
debugger.getProcessManager().setActiveThread(null);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().removeThread(thread);
assertFalse(m_refreshButton.isEnabled());
debugger.getProcessManager().setAttached(false);
m_synchronizer.dispose();
debugger.close();
}
Aggregations