use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.
the class CBookmarkFunctionsTest method test3DeleteBookmarksNoManager.
@Test
public void test3DeleteBookmarksNoManager() {
final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
final MockAddress mockAddress = new MockAddress();
final MockModule mockModule = new MockModule();
CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
final int[] foo = { 0 };
try {
CBookmarkFunctions.deleteBookmarks(null, foo);
fail();
} catch (final NullPointerException e) {
}
}
use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.
the class CBookmarksTableModelTest method test2getValueAt.
@Test
public void test2getValueAt() {
final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
final IAddress address = new MockAddress();
final CBookmark bookmark = new CBookmark(address, "foo");
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
debuggerProvider.addDebugger(debugger);
final BookmarkManager bookmarkManager = debugger.getBookmarkManager();
bookmarkManager.addBookmark(bookmark);
assertEquals(1, bookmarkManager.getNumberOfBookmarks());
assertEquals("foo", model.getValueAt(0, 2));
assertEquals(address.toHexString(), model.getValueAt(0, 1));
assertEquals(debugger.getPrintableString(), model.getValueAt(0, 0));
final int[] rows = { 0 };
CBookmarkFunctions.deleteBookmarks(debuggerProvider, rows);
assertEquals(0, bookmarkManager.getNumberOfBookmarks());
model.dispose();
}
use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.
the class CCodeBookmarkTableModelTest method test9checkRemoveListeners.
@Test
public void test9checkRemoveListeners() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
final LinkedHashSet<?> m_daListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmarkManager, "m_listeners"), "m_listeners");
assertEquals(1, m_daListeners.size());
final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
bookmarkManager.addBookmark(bookmark);
final LinkedHashSet<?> m_bmListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmark, "m_listeners"), "m_listeners");
assertEquals(1, m_bmListeners.size());
tableModel.dispose();
assertTrue(m_daListeners.isEmpty());
assertTrue(m_bmListeners.isEmpty());
}
use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.
the class CProjectContainerTest method testGetViewsWithAddresses.
@Test
public void testGetViewsWithAddresses() throws CouldntLoadDataException {
final CProjectContainer container = new CProjectContainer(m_database, m_project);
@SuppressWarnings("unused") final INaviView view = container.createView("view1", "information");
final UnrelocatedAddress address = new UnrelocatedAddress(new MockAddress());
final IFilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
addresses.add(address);
try {
container.getViewsWithAddresses(null, true);
fail();
} catch (final NullPointerException e) {
}
// assertNull(container.getViewsWithAddresses(addresses, true));
}
use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.
the class CBoookmarkFunctionsTest method test2DeleteBookmarks.
@Test
public void test2DeleteBookmarks() {
final DebugTargetSettings target = new ModuleTargetSettings(CommonTestObjects.MODULE);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final CBookmarkTableModel model = new CBookmarkTableModel(debuggerProvider);
final CBookmark bookmark = new CBookmark(new MockAddress(), "foo");
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(CommonTestObjects.MODULE));
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, CommonTestObjects.BP_ADDRESS_0_SET);
debuggerProvider.addDebugger(debugger);
final BookmarkManager bookmarkManager = debugger.getBookmarkManager();
bookmarkManager.addBookmark(bookmark);
assertEquals(1, bookmarkManager.getNumberOfBookmarks());
final int[] rows = { 0 };
CBookmarkFunctions.deleteBookmarks(debuggerProvider, rows);
assertEquals(0, bookmarkManager.getNumberOfBookmarks());
model.dispose();
}
Aggregations