示例#1
0
        public void ReplayEvents(Action completionHandler = null)
        {
            AutoTestSession testSession = new AutoTestSession();
            Stopwatch       sw          = new Stopwatch();
            int             eventCount  = events.Count;

            state = State.Replaying;

            sw.Start();
            // Each spin of the main loop, remove an event from the queue and replay it.
            GLib.Idle.Add(() => {
                RecordEvent ev = events[0];
                events.RemoveAt(0);

                ev.Replay(testSession);

                if (events.Count > 0)
                {
                    return(true);
                }

                sw.Stop();
                LoggingService.LogInfo("Time elapsed to replay {0} events: {1}", eventCount, sw.Elapsed);
                state = State.Idle;

                if (completionHandler != null)
                {
                    completionHandler();
                }

                return(false);
            });
        }
示例#2
0
        public void AttachApplication()
        {
            MonoDevelop.Core.Execution.RemotingService.RegisterRemotingChannel();

            string sref = File.ReadAllText(AutoTestService.SessionReferenceFile);

            byte[]          data = Convert.FromBase64String(sref);
            MemoryStream    ms   = new MemoryStream(data);
            BinaryFormatter bf   = new BinaryFormatter();

            service = (IAutoTestService)bf.Deserialize(ms);
            session = service.AttachClient(this);
        }
示例#3
0
 public void DetachClient(IAutoTestClient client)
 {
     if (client == this.client)
     {
         this.client = null;
         currentSession?.Dispose();
         currentSession = null;
     }
     else
     {
         throw new InvalidOperationException("Not connected");
     }
 }
 public AutoTestSession AttachClient(IAutoTestClient client)
 {
     if (this.client != null)
     {
         // Make sure the current client is alive
         NotifyEvent("Ping");
         if (this.client != null)
         {
             throw new InvalidOperationException("A client is already connected");
         }
     }
     this.client = client;
     if (currentSession == null)
     {
         currentSession = new AutoTestSession();
     }
     return(currentSession);
 }
示例#5
0
            public override void Replay(AutoTestSession testSession)
            {
                AppQuery query = testSession.CreateNewQuery();

                AppResult[] results = query.Window().Marked("MonoDevelop.Ide.Gui.DefaultWorkbench").Execute();
                if (results.Length == 0)
                {
                    return;
                }

                testSession.Select(results [0]);

                if (results [0] is AutoTest.Results.GtkWidgetResult)
                {
                    AutoTest.Results.GtkWidgetResult widgetResult = (AutoTest.Results.GtkWidgetResult)results [0];
                    widgetResult.EnterText(Text);
                }
            }
示例#6
0
            public override void Replay(AutoTestSession testSession)
            {
                // Select the main window and then we can push key events to it.
                AppQuery query = testSession.CreateNewQuery();

                AppResult[] results = query.Window().Marked("MonoDevelop.Ide.Gui.DefaultWorkbench").Execute();
                if (results.Length == 0)
                {
                    return;
                }

                testSession.Select(results[0]);
                // We need the GtkWidgetResult for the main window as we only have the keys as a Gdk key
                if (results [0] is AutoTest.Results.GtkWidgetResult)
                {
                    AutoTest.Results.GtkWidgetResult widgetResult = (AutoTest.Results.GtkWidgetResult)results[0];
                    widgetResult.RealTypeKey(Key, Modifiers);
                }
            }
		public void AttachApplication ()
		{
			AutoTestService.SetupRemoting ();

			string sref = File.ReadAllText (AutoTestService.SessionReferenceFile);
			byte[] data = Convert.FromBase64String (sref);
			MemoryStream ms = new MemoryStream (data);
			BinaryFormatter bf = new BinaryFormatter ();
			service = (IAutoTestService) bf.Deserialize (ms);
			session = service.AttachClient (this);
		}
		void IAutoTestClient.Connect (AutoTestSession session)
		{
			this.session = session;
			waitEvent.Set ();
		}
示例#9
0
 public AutoTestToolbar(AutoTestSession session)
 {
     this.session = session;
 }
示例#10
0
 void IAutoTestClient.Connect(AutoTestSession session)
 {
     this.session = session;
     waitEvent.Set();
 }
			public abstract void Replay (AutoTestSession testSession);
			public override void Replay (AutoTestSession testSession)
			{
				// Select the main window and then we can push key events to it.
				AppQuery query = testSession.CreateNewQuery ();
				AppResult[] results = query.Window ().Marked ("MonoDevelop.Ide.Gui.DefaultWorkbench").Execute ();
				if (results.Length == 0) {
					return;
				}

				testSession.Select (results[0]);
				// We need the GtkWidgetResult for the main window as we only have the keys as a Gdk key
				if (results [0] is AutoTest.Results.GtkWidgetResult) {
					AutoTest.Results.GtkWidgetResult widgetResult = (AutoTest.Results.GtkWidgetResult) results[0];
					widgetResult.RealTypeKey (Key, Modifiers);
				}
			}
示例#13
0
 public override void Replay(AutoTestSession testSession)
 {
     testSession.ExecuteCommand(CommandId);
 }
		public AutoTestSession AttachClient (IAutoTestClient client)
		{
			if (this.client != null) {
				// Make sure the current client is alive
				NotifyEvent ("Ping");
				if (this.client != null)
					throw new InvalidOperationException ("A client is already connected");
			}
			this.client = client;
			if (currentSession == null)
				currentSession = new AutoTestSession ();
			return currentSession;
		}
示例#15
0
 public abstract void Replay(AutoTestSession testSession);
		public void ReplayEvents (Action completionHandler = null)
		{
			AutoTestSession testSession = new AutoTestSession ();
			Stopwatch sw = new Stopwatch ();
			int eventCount = events.Count;

			state = State.Replaying;
			
			sw.Start ();
			// Each spin of the main loop, remove an event from the queue and replay it.
			GLib.Idle.Add (() => {
				RecordEvent ev = events[0];
				events.RemoveAt (0);

				ev.Replay (testSession);

				if (events.Count > 0) {
					return true;
				}

				sw.Stop ();
				LoggingService.LogInfo ("Time elapsed to replay {0} events: {1}", eventCount, sw.Elapsed);
				state = State.Idle;

				if (completionHandler != null) {
					completionHandler ();
				}

				return false;
			});
		}
			public override void Replay (AutoTestSession testSession)
			{
				testSession.ExecuteCommand (CommandId);
			}
			public override void Replay (AutoTestSession testSession)
			{
				AppQuery query = testSession.CreateNewQuery ();
				AppResult[] results = query.Window ().Marked ("MonoDevelop.Ide.Gui.DefaultWorkbench").Execute ();
				if (results.Length == 0) {
					return;
				}

				testSession.Select (results [0]);

				if (results [0] is AutoTest.Results.GtkWidgetResult) {
					AutoTest.Results.GtkWidgetResult widgetResult = (AutoTest.Results.GtkWidgetResult)results [0];
					widgetResult.EnterText (Text);
				}
			}