mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-01-10 06:27:59 -05:00
fixing junit tests for actions that moved to new plugin
This commit is contained in:
@@ -132,6 +132,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
private void setUpCodeBrowserTool(PluginTool tool) throws Exception {
|
||||
tool.addPlugin(CodeBrowserPlugin.class.getName());
|
||||
tool.addPlugin(NextPrevAddressPlugin.class.getName());
|
||||
tool.addPlugin(CodeBrowserSelectionPlugin.class.getName());
|
||||
addPlugin(tool, SymbolTablePlugin.class);
|
||||
}
|
||||
|
||||
@@ -472,7 +473,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSelectAll() {
|
||||
DockingActionIf action = getAction(cb, "Select All");
|
||||
DockingActionIf action = getAction(tool, "Select All");
|
||||
performAction(action, cb.getProvider(), true);
|
||||
ProgramSelection ps = getCurrentSelection();
|
||||
AddressSet set1 = new AddressSet(program.getMemory());
|
||||
@@ -482,7 +483,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSelectComplementOnAllProgram() {
|
||||
DockingActionIf action = getAction(cb, "Select Complement");
|
||||
DockingActionIf action = getAction(tool, "Select Complement");
|
||||
ProgramSelection allSelection = new ProgramSelection(program.getMemory());
|
||||
ProgramSelection noneSelection = new ProgramSelection();
|
||||
assertEquals(noneSelection, cb.getCurrentSelection());
|
||||
@@ -499,7 +500,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSelectComplementOnAllView() {
|
||||
DockingActionIf action = getAction(cb, "Select Complement");
|
||||
DockingActionIf action = getAction(tool, "Select Complement");
|
||||
AddressSet viewSet = new AddressSet(addr("0x1001000"), addr("0x10012ff"));
|
||||
setView(viewSet);
|
||||
ProgramSelection allSelection = new ProgramSelection(viewSet);
|
||||
@@ -515,7 +516,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSelectComplementOnSomeOfProgram() {
|
||||
DockingActionIf action = getAction(cb, "Select Complement");
|
||||
DockingActionIf action = getAction(tool, "Select Complement");
|
||||
AddressSetView programSet = program.getMemory();
|
||||
AddressSet initialSelectSet = new AddressSet();
|
||||
initialSelectSet.addRange(addr("0x10011e8"), addr("0x10011ef"));
|
||||
@@ -537,7 +538,7 @@ public class CodeBrowserTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void testSelectComplementOnSomeOfView() {
|
||||
DockingActionIf action = getAction(cb, "Select Complement");
|
||||
DockingActionIf action = getAction(tool, "Select Complement");
|
||||
AddressSet viewSet = new AddressSet(addr("0x1001000"), addr("0x10012ff"));
|
||||
setView(viewSet);
|
||||
AddressSet initialSelectSet = new AddressSet();
|
||||
|
||||
@@ -38,8 +38,6 @@ import ghidra.app.events.ProgramSelectionPluginEvent;
|
||||
import ghidra.app.plugin.core.clear.ClearDialog;
|
||||
import ghidra.app.plugin.core.clear.ClearPlugin;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.navigation.GoToAddressLabelPlugin;
|
||||
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
@@ -72,23 +70,16 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
env = new TestEnv();
|
||||
tool = env.getTool();
|
||||
tool = env.launchDefaultTool();
|
||||
setupTool(tool);
|
||||
|
||||
cb = env.getPlugin(CodeBrowserPlugin.class);
|
||||
|
||||
showTool(tool);
|
||||
loadProgram("notepad");
|
||||
|
||||
cb.updateNow();
|
||||
}
|
||||
|
||||
private void setupTool(PluginTool tool) throws Exception {
|
||||
tool.addPlugin(CodeBrowserPlugin.class.getName());
|
||||
tool.addPlugin(NextPrevAddressPlugin.class.getName());
|
||||
tool.addPlugin(DisassemblerPlugin.class.getName());
|
||||
tool.addPlugin(ClearPlugin.class.getName());
|
||||
tool.addPlugin(GoToAddressLabelPlugin.class.getName());
|
||||
cb = env.getPlugin(CodeBrowserPlugin.class);
|
||||
|
||||
ClearPlugin cp = getPlugin(tool, ClearPlugin.class);
|
||||
clearAction = getAction(cp, "Clear Code Bytes");
|
||||
@@ -555,7 +546,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
// 1 function with it's label
|
||||
assertEquals(6, program.getSymbolTable().getNumSymbols());
|
||||
|
||||
DockingActionIf action = getAction(cb, "Select All");
|
||||
DockingActionIf action = getAction(tool, "Select All");
|
||||
performAction(action, cb.getProvider(), true);
|
||||
|
||||
performAction(clearWithOptionsAction, cb.getProvider(), false);
|
||||
@@ -600,7 +591,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
assertTrue(program.getBookmarkManager().getBookmarkCount() > 0);
|
||||
|
||||
final DockingActionIf action = getAction(cb, "Select All");
|
||||
final DockingActionIf action = getAction(tool, "Select All");
|
||||
performAction(action, cb.getProvider(), true);
|
||||
|
||||
performAction(clearWithOptionsAction, cb.getProvider(), false);
|
||||
@@ -629,7 +620,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
||||
|
||||
assertTrue(program.getListing().getFunctions(true).hasNext());
|
||||
|
||||
DockingActionIf action = getAction(cb, "Select All");
|
||||
DockingActionIf action = getAction(tool, "Select All");
|
||||
performAction(action, cb.getProvider(), true);
|
||||
|
||||
performAction(clearWithOptionsAction, cb.getProvider(), false);
|
||||
|
||||
@@ -30,8 +30,6 @@ import ghidra.app.plugin.core.analysis.AutoAnalysisManager;
|
||||
import ghidra.app.plugin.core.clear.ClearCmd;
|
||||
import ghidra.app.plugin.core.clear.ClearPlugin;
|
||||
import ghidra.app.plugin.core.codebrowser.CodeBrowserPlugin;
|
||||
import ghidra.app.plugin.core.navigation.GoToAddressLabelPlugin;
|
||||
import ghidra.app.plugin.core.navigation.NextPrevAddressPlugin;
|
||||
import ghidra.app.services.ProgramManager;
|
||||
import ghidra.framework.plugintool.PluginTool;
|
||||
import ghidra.program.disassemble.Disassembler;
|
||||
@@ -56,19 +54,14 @@ public class DisassemblerPluginTest extends AbstractGhidraHeadedIntegrationTest
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
env = new TestEnv();
|
||||
tool = env.getTool();
|
||||
tool = env.launchDefaultTool();
|
||||
setupTool(tool);
|
||||
|
||||
cb = env.getPlugin(CodeBrowserPlugin.class);
|
||||
}
|
||||
|
||||
private void setupTool(PluginTool tool) throws Exception {
|
||||
tool.addPlugin(CodeBrowserPlugin.class.getName());
|
||||
tool.addPlugin(NextPrevAddressPlugin.class.getName());
|
||||
tool.addPlugin(DisassemblerPlugin.class.getName());
|
||||
tool.addPlugin(ClearPlugin.class.getName());
|
||||
tool.addPlugin(GoToAddressLabelPlugin.class.getName());
|
||||
|
||||
cb = env.getPlugin(CodeBrowserPlugin.class);
|
||||
DisassemblerPlugin dp = getPlugin(tool, DisassemblerPlugin.class);
|
||||
disassemblyAction = getAction(dp, "Disassemble");
|
||||
staticDisassemblyAction = getAction(dp, "Disassemble Static");
|
||||
@@ -419,7 +412,7 @@ public class DisassemblerPluginTest extends AbstractGhidraHeadedIntegrationTest
|
||||
}
|
||||
|
||||
private void clearAll() throws Exception {
|
||||
DockingActionIf action = getAction(cb, "Select All");
|
||||
DockingActionIf action = getAction(tool, "Select All");
|
||||
performAction(action, cb.getProvider(), true);
|
||||
ClearPlugin dp = getPlugin(tool, ClearPlugin.class);
|
||||
DockingActionIf clearAction = getAction(dp, "Clear Code Bytes");
|
||||
|
||||
@@ -59,8 +59,10 @@ public class GTreeTest extends AbstractDockingTest {
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
gTree.dispose();
|
||||
frame.dispose();
|
||||
runSwing(() -> {
|
||||
gTree.dispose();
|
||||
frame.dispose();
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user