Ejemplo n.º 1
0
 public void RegisterJumpItem_CloseProgram_ActivateItem_CheckActionExecuted()
 {
     try {
         TestJumpAction jumpAction = new TestJumpAction();
         TestProcess.AddApplication("test.exe", p => {
             using (JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout)) {
                 GC.SuppressFinalize(jumpActionsManager);
                 jumpAction.CommandId = "Run Command!";
                 jumpAction.Action    = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                 } finally {
                     jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 p.DoEvents();
             }
         });
         TestProcess process = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "13");
         process.Start();
         process.GetBreakpoint("registered").WaitAndContinue();
         process.SendCloseMessage();
         process.WaitExit();
         new TestProcess(applicationID, this, jumpAction.StartInfo, "14").Start();
         process = TestProcess.WaitProcessStart("test.exe", this);
         process.GetBreakpoint("registered").WaitAndContinue();
         process.GetBreakpoint("action").WaitAndContinue();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
 public void RegisterJumpItem_CloseProgram_ActivateItem_CheckActionExecuted() {
     try {
         TestJumpAction jumpAction = new TestJumpAction();
         TestProcess.AddApplication("test.exe", p => {
             using(JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout)) {
                 jumpAction.CommandId = "Run Command!";
                 jumpAction.Action = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                 } finally {
                     jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 p.DoEvents();
             }
         });
         TestProcess process = new TestProcess(this, new ProcessStartInfo("test.exe"));
         process.Start();
         process.GetBreakpoint("registered").WaitAndContinue();
         process.WaitExit();
         new TestProcess(this, jumpAction.StartInfo).Start();
         process = TestProcess.WaitProcessStart("test.exe", this);
         process.GetBreakpoint("registered").WaitAndContinue();
         process.GetBreakpoint("action").WaitAndContinue();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
Ejemplo n.º 3
0
 public void StartTwoInstances_RegisterJumpItem_KillSecondInstance_ActivateItem_CheckActionExecuted()
 {
     try {
         int actionIndex = 0;
         TestJumpAction[] jumpActions = new TestJumpAction[] { new TestJumpAction(), new TestJumpAction() };
         TestProcess.AddApplication("test.exe", p => {
             JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout);
             GC.SuppressFinalize(jumpActionsManager);
             try {
                 TestJumpAction jumpAction = jumpActions[actionIndex++];
                 jumpAction.CommandId      = "Run Command!";
                 jumpAction.Action         = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                 } finally {
                     jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 if (!p.CommandLineArgs.Skip(1).Any())
                 {
                     p.EnvironmentExit();
                 }
                 p.DoEvents();
             } finally {
                 if (!p.DoEnvironmentExit)
                 {
                     jumpActionsManager.Dispose();
                 }
             }
         });
         TestProcess process1 = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe", "do_not_kill"), "5");
         TestProcess process2 = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "6");
         process1.Start();
         process2.Start();
         process1.GetBreakpoint("registered").Wait();
         process2.GetBreakpoint("registered").Wait();
         process1.GetBreakpoint("registered").Continue();
         process2.GetBreakpoint("registered").Continue();
         process2.WaitExit();
         new TestProcess(applicationID, this, jumpActions[0].StartInfo, "7").Start();
         process1.GetBreakpoint("action").WaitAndContinue();
         process1.SendCloseMessage();
         process1.WaitExit();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
Ejemplo n.º 4
0
 public void RegisterJumpItem_StartAnotherInstance_KillAnotherInstance_CloseProgram()
 {
     try {
         int actionIndex = 0;
         TestJumpAction[] jumpActions = new TestJumpAction[] { new TestJumpAction(), new TestJumpAction() };
         TestProcess.AddApplication("test.exe", p => {
             JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout);
             GC.SuppressFinalize(jumpActionsManager);
             try {
                 TestJumpAction jumpAction = jumpActions[actionIndex++];
                 jumpAction.CommandId      = "Run Command!";
                 jumpAction.Action         = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                     if (p.CommandLineArgs.Skip(1).Any())
                     {
                         p.EnvironmentExit();
                     }
                 } finally {
                     if (!p.DoEnvironmentExit)
                     {
                         jumpActionsManager.EndUpdate();
                     }
                 }
                 p.GetBreakpoint("registered").Reach();
                 p.DoEvents();
             } finally {
                 if (!p.DoEnvironmentExit)
                 {
                     jumpActionsManager.Dispose();
                 }
             }
         });
         TestProcess process = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "11");
         process.Start();
         process.GetBreakpoint("registered").WaitAndContinue();
         TestProcess processToKill = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe", "kill"), "12");
         processToKill.Start();
         processToKill.WaitExit();
         process.SendCloseMessage();
         process.WaitExit();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
Ejemplo n.º 5
0
 public void RegisterJumpItem_KillProcess_ActivateItem_CheckActionExecuted()
 {
     try {
         TestJumpAction jumpAction = new TestJumpAction();
         TestProcess.AddApplication("test.exe", p => {
             JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout);
             GC.SuppressFinalize(jumpActionsManager);
             try {
                 jumpAction.CommandId = "Run Command!";
                 jumpAction.Action    = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                 } finally {
                     jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 if (!p.CommandLineArgs.Skip(1).Any())
                 {
                     p.EnvironmentExit();
                 }
                 p.DoEvents();
             } finally {
                 if (!p.DoEnvironmentExit)
                 {
                     jumpActionsManager.Dispose();
                 }
             }
         });
         TestProcess process = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "9");
         process.Start();
         process.GetBreakpoint("registered").WaitAndContinue();
         process.WaitExit();
         new TestProcess(applicationID, this, jumpAction.StartInfo, "10").Start();
         process = TestProcess.WaitProcessStart("test.exe", this);
         process.GetBreakpoint("registered").WaitAndContinue();
         process.GetBreakpoint("action").WaitAndContinue();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
 public void RegisterJumpItem_StartAnotherInstance_KillAnotherInstance_CloseProgram() {
     try {
         int actionIndex = 0;
         TestJumpAction[] jumpActions = new TestJumpAction[] { new TestJumpAction(), new TestJumpAction() };
         TestProcess.AddApplication("test.exe", p => {
             JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout);
             GC.SuppressFinalize(jumpActionsManager);
             try {
                 TestJumpAction jumpAction = jumpActions[actionIndex++];
                 jumpAction.CommandId = "Run Command!";
                 jumpAction.Action = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                     if(p.CommandLineArgs.Skip(1).Any())
                         p.EnvironmentExit();
                 } finally {
                     if(!p.DoEnvironmentExit)
                         jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 p.DoEvents();
             } finally {
                 if(!p.DoEnvironmentExit)
                     jumpActionsManager.Dispose();
             }
         });
         TestProcess process = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "11");
         process.Start();
         process.GetBreakpoint("registered").WaitAndContinue();
         TestProcess processToKill = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe", "kill"), "12");
         processToKill.Start();
         processToKill.WaitExit();
         process.SendCloseMessage();
         process.WaitExit();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
 public void StartTwoInstances_RegisterJumpItem_KillSecondInstance_ActivateItem_CheckActionExecuted() {
     try {
         int actionIndex = 0;
         TestJumpAction[] jumpActions = new TestJumpAction[] { new TestJumpAction(), new TestJumpAction() };
         TestProcess.AddApplication("test.exe", p => {
             JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout);
             GC.SuppressFinalize(jumpActionsManager);
             try {
                 TestJumpAction jumpAction = jumpActions[actionIndex++];
                 jumpAction.CommandId = "Run Command!";
                 jumpAction.Action = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                 } finally {
                     jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 if(!p.CommandLineArgs.Skip(1).Any())
                     p.EnvironmentExit();
                 p.DoEvents();
             } finally {
                 if(!p.DoEnvironmentExit)
                     jumpActionsManager.Dispose();
             }
         });
         TestProcess process1 = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe", "do_not_kill"), "5");
         TestProcess process2 = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "6");
         process1.Start();
         process2.Start();
         process1.GetBreakpoint("registered").Wait();
         process2.GetBreakpoint("registered").Wait();
         process1.GetBreakpoint("registered").Continue();
         process2.GetBreakpoint("registered").Continue();
         process2.WaitExit();
         new TestProcess(applicationID, this, jumpActions[0].StartInfo, "7").Start();
         process1.GetBreakpoint("action").WaitAndContinue();
         process1.SendCloseMessage();
         process1.WaitExit();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }
 public void RegisterJumpItem_KillProcess_ActivateItem_CheckActionExecuted() {
     try {
         TestJumpAction jumpAction = new TestJumpAction();
         TestProcess.AddApplication("test.exe", p => {
             JumpActionsManager jumpActionsManager = new JumpActionsManager(p, MillisecondsTimeout);
             GC.SuppressFinalize(jumpActionsManager);
             try {
                 jumpAction.CommandId = "Run Command!";
                 jumpAction.Action = () => {
                     p.GetBreakpoint("action").Reach();
                 };
                 jumpActionsManager.BeginUpdate();
                 try {
                     jumpActionsManager.RegisterAction(jumpAction, "/DO=", () => "launcher.exe");
                 } finally {
                     jumpActionsManager.EndUpdate();
                 }
                 p.GetBreakpoint("registered").Reach();
                 if(!p.CommandLineArgs.Skip(1).Any())
                     p.EnvironmentExit();
                 p.DoEvents();
             } finally {
                 if(!p.DoEnvironmentExit)
                     jumpActionsManager.Dispose();
             }
         });
         TestProcess process = new TestProcess(applicationID, this, new ProcessStartInfo("test.exe"), "9");
         process.Start();
         process.GetBreakpoint("registered").WaitAndContinue();
         process.WaitExit();
         new TestProcess(applicationID, this, jumpAction.StartInfo, "10").Start();
         process = TestProcess.WaitProcessStart("test.exe", this);
         process.GetBreakpoint("registered").WaitAndContinue();
         process.GetBreakpoint("action").WaitAndContinue();
     } finally {
         TestProcess.WaitAllProcessesExit();
     }
 }