Search in sources :

Example 76 with INaviView

use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.

the class CModuleTest method test_C_getFunction2.

@Test
public void test_C_getFunction2() throws CouldntLoadDataException, LoadCancelledException {
    try {
        m_module.getContent().getViewContainer().getFunction((INaviView) null);
        fail();
    } catch (final NullPointerException exception) {
    }
    m_module.load();
    int counter = 0;
    final List<INaviFunction> functions = m_module.getContent().getFunctionContainer().getFunctions();
    for (final INaviView view : m_module.getContent().getViewContainer().getNativeFlowgraphViews()) {
        assertEquals(functions.get(counter), m_module.getContent().getViewContainer().getFunction(view));
        counter++;
    }
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) Test(org.junit.Test)

Example 77 with INaviView

use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.

the class CPostgreSQLModuleContentTest method testDeleteView.

@Test
public void testDeleteView() throws LoadCancelledException, CouldntLoadDataException, CouldntDeleteException {
    final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
    module.load();
    final CModuleContent moduleContent1 = module.getContent();
    assertNotNull(moduleContent1);
    final CView view = moduleContent1.getViewContainer().createView("name", "desc");
    assertNotNull(view);
    try {
        moduleContent1.getViewContainer().deleteView(null);
        fail();
    } catch (final NullPointerException e) {
    }
    assertEquals(1, moduleContent1.getViewContainer().getCustomViewCount());
    moduleContent1.getViewContainer().deleteView(view);
    assertEquals(0, moduleContent1.getViewContainer().getCustomViewCount());
    try {
        moduleContent1.getViewContainer().deleteView(view);
        fail();
    } catch (final IllegalArgumentException e) {
    }
    try {
        moduleContent1.getViewContainer().deleteView(null);
        fail();
    } catch (final NullPointerException e) {
    }
    CView nativeView = null;
    for (final INaviView view1 : module.getContent().getViewContainer().getViews()) {
        if (view1.getType() == ViewType.Native) {
            nativeView = (CView) view1;
        }
    }
    try {
        moduleContent1.getViewContainer().deleteView(nativeView);
        fail();
    } catch (final IllegalStateException e) {
    }
    try {
        moduleContent1.close();
        moduleContent1.getViewContainer().deleteView(view);
        fail();
    } catch (final IllegalStateException e) {
    }
}
Also used : CView(com.google.security.zynamics.binnavi.disassembly.views.CView) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 78 with INaviView

use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.

the class CPostgreSQLModuleContentTest method testCModuleContentConstructor.

@Test
public void testCModuleContentConstructor() throws LoadCancelledException, CouldntLoadDataException {
    final CModule module = (CModule) getDatabase().getContent().getModules().get(0);
    module.load();
    final ListenerProvider<IModuleListener> listeners = new ListenerProvider<IModuleListener>();
    final CCallgraph callgraph = module.getContent().getNativeCallgraph();
    final IFilledList<INaviFunction> functions = new FilledList<INaviFunction>();
    functions.add(module.getContent().getFunctionContainer().getFunctions().get(0));
    final ICallgraphView nativeCallgraph = module.getContent().getViewContainer().getNativeCallgraphView();
    final ImmutableList<IFlowgraphView> nativeFlowgraphs = module.getContent().getViewContainer().getNativeFlowgraphViews();
    final List<INaviView> customViews = new ArrayList<INaviView>();
    final ImmutableBiMap<INaviView, INaviFunction> viewFunctionMap = new ImmutableBiMap.Builder<INaviView, INaviFunction>().build();
    new Pair<HashMap<INaviView, INaviFunction>, HashMap<INaviFunction, INaviView>>(null, null);
    final IFilledList<TraceList> traces = new FilledList<TraceList>();
    final SectionContainer sections = new SectionContainer(new SectionContainerBackend(getProvider(), module));
    final TypeInstanceContainer instances = new TypeInstanceContainer(new TypeInstanceContainerBackend(getProvider(), module, module.getTypeManager(), sections), getProvider());
    final CModuleContent moduleContent1 = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, sections, instances);
    assertNotNull(moduleContent1);
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(null, null, null, null, null, null, null, null, null, null, sections, instances);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, null, null, null, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), null, null, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, null, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, null, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, null, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, null, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, null, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, null, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, null, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
    try {
        @SuppressWarnings("unused") final CModuleContent moduleContent = new CModuleContent(module, getProvider(), listeners, callgraph, functions, nativeCallgraph, nativeFlowgraphs, customViews, viewFunctionMap, traces, null, null);
        fail();
    } catch (final NullPointerException e) {
    }
}
Also used : IFlowgraphView(com.google.security.zynamics.binnavi.disassembly.IFlowgraphView) FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) IFilledList(com.google.security.zynamics.zylib.types.lists.IFilledList) ArrayList(java.util.ArrayList) TypeInstanceContainerBackend(com.google.security.zynamics.binnavi.disassembly.types.TypeInstanceContainerBackend) Pair(com.google.security.zynamics.zylib.general.Pair) SectionContainerBackend(com.google.security.zynamics.binnavi.disassembly.types.SectionContainerBackend) CCallgraph(com.google.security.zynamics.binnavi.disassembly.CCallgraph) ICallgraphView(com.google.security.zynamics.binnavi.disassembly.ICallgraphView) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) ImmutableBiMap(com.google.common.collect.ImmutableBiMap) SectionContainer(com.google.security.zynamics.binnavi.disassembly.types.SectionContainer) TraceList(com.google.security.zynamics.binnavi.debug.models.trace.TraceList) ListenerProvider(com.google.security.zynamics.zylib.general.ListenerProvider) TypeInstanceContainer(com.google.security.zynamics.binnavi.disassembly.types.TypeInstanceContainer) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 79 with INaviView

use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.

the class CProjectContainerTest method testDeleteView.

@Test
public void testDeleteView() throws CouldntDeleteException {
    final CProjectContainer container = new CProjectContainer(m_database, m_project);
    final INaviView view = container.createView("foo", "berT");
    assertNotNull(view);
    try {
        container.deleteView(null);
        fail();
    } catch (final NullPointerException e) {
    }
    container.deleteView(view);
    assertEquals(2, container.getViews().size());
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Test(org.junit.Test)

Example 80 with INaviView

use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.

the class CProjectContentTest method testGetTaggedViews2.

@Test
public void testGetTaggedViews2() {
    final CProjectContent projectContent = new CProjectContent(m_project, m_listeners, m_provider, m_addressSpaces, m_views, m_traces);
    @SuppressWarnings("unused") final INaviView view = new MockView(m_provider);
    @SuppressWarnings("unused") final INaviView view2 = projectContent.createView("Name", "description");
    assertNotNull(CViewFilter.getTaggedViews(projectContent.getViews(), new CTag(4, "foo", "bar", TagType.VIEW_TAG, m_provider)));
}
Also used : INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) Test(org.junit.Test)

Aggregations

INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)121 Test (org.junit.Test)54 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)29 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)26 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)18 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)14 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)11 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)10 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)10 ArrayList (java.util.ArrayList)10 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)9 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)8 HashMap (java.util.HashMap)8 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)7 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)7 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)7 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)7 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)7 MockTagManager (com.google.security.zynamics.binnavi.Tagging.MockTagManager)6