use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class CTraceLoggerTest method testOverwrittenAllEchoBreakpoints.
@Test
public void testOverwrittenAllEchoBreakpoints() throws DebugExceptionWrapper {
// Scenario: All echo breakpoints of the trace are overwritten by regular breakpoints
final ITraceListProvider provider = new MockTraceListProvider();
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(module));
debugger.setAddressTranslator(module, new CAddress(0), new CAddress(0x1000));
debugger.connect();
final TraceLogger logger = new TraceLogger(provider, debugger);
final MockTraceLoggerListener listener = new MockTraceLoggerListener();
logger.addListener(listener);
final MockSqlProvider sqlProvider = new MockSqlProvider();
final TraceList trace = new TraceList(1, "Foo", "Bar", sqlProvider);
final Set<BreakpointAddress> addresses = new HashSet<BreakpointAddress>();
addresses.add(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100))));
addresses.add(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x200))));
logger.start(trace, addresses, 1);
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x100)))));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0x200)))));
logger.stop();
assertEquals("++--!", listener.events);
// Start the trace mode again to make sure all resources were cleaned
// up in the previous run.
logger.start(trace, addresses, 1);
logger.stop();
debugger.close();
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class ViewReferencesTableModelTest method setup.
@Before
public void setup() throws CouldntLoadDataException {
typeSystem = new TestTypeSystem(new TypeManager(new TypeManagerMockBackend()));
view = MockView.getFullView(new MockSqlProvider(), ViewType.Native, 123);
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class CGraphDebuggerTest method testGetDebugger2.
@Test
public void testGetDebugger2() {
final MockModule module = new MockModule();
module.getConfiguration().setDebugger(m_debugger);
final DebugTargetSettings target = new ModuleTargetSettings(module);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
debuggerProvider.addDebugger(m_debugger);
final CFunction function = new CFunction(module, new MockView(), new CAddress(0x123), "Mock Function", "Mock Function", "Mock Description", 0, 0, 0, 0, FunctionType.NORMAL, "", 0, null, null, null, m_provider);
final ArrayList<IComment> comments = Lists.<IComment>newArrayList(new CComment(null, CommonTestObjects.TEST_USER_1, null, "Mock Comment"));
final INaviCodeNode codeNode = new CCodeNode(0, 0, 0, 0, 0, Color.RED, Color.RED, false, false, comments, function, new HashSet<CTag>(), new MockSqlProvider());
codeNode.addInstruction(new CInstruction(true, module, new CAddress(0x123), "nop", new ArrayList<COperandTree>(), new byte[] { (byte) 0x90 }, "x86-32", m_provider), null);
assertEquals(m_debugger, CGraphDebugger.getDebugger(debuggerProvider, Iterables.getFirst(codeNode.getInstructions(), null)));
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class CTaggedGraphNodesContainerNodeTest method test1Simple.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CTagsTreeModel model = new CTagsTreeModel(null);
final CTag tag = new CTag(0, "tag", "description", TagType.NODE_TAG, new MockSqlProvider());
final TreeNode<CTag> treeNode = new TreeNode<CTag>(tag);
final CTaggedGraphNodesContainerNode containerNode = new CTaggedGraphNodesContainerNode(graph, model, treeNode);
assertEquals("Tagged Nodes (0/0/1/1)", containerNode.toString());
assertEquals(null, containerNode.getIconName());
containerNode.getIcon();
}
use of com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider in project binnavi by google.
the class CModuleTest method testInSameDatabase.
@Test
public void testInSameDatabase() throws CouldntLoadDataException, LoadCancelledException {
m_module.load();
assertFalse(m_module.inSameDatabase(new MockSqlProvider()));
assertTrue(m_module.inSameDatabase(m_sql));
try {
m_module.inSameDatabase((SQLProvider) null);
fail();
} catch (final NullPointerException e) {
}
final MockDatabase database = new MockDatabase();
assertFalse(m_module.inSameDatabase(database));
try {
m_module.inSameDatabase((IDatabaseObject) null);
fail();
} catch (final NullPointerException e) {
}
}
Aggregations