Exemplo n.º 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);
            });
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
 }
Exemplo n.º 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);
                }
            }
Exemplo n.º 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 ();
		}
Exemplo n.º 9
0
 public AutoTestToolbar(AutoTestSession session)
 {
     this.session = session;
 }
Exemplo n.º 10
0
 void IAutoTestClient.Connect(AutoTestSession session)
 {
     this.session = session;
     waitEvent.Set();
 }
Exemplo n.º 11
0
			public abstract void Replay (AutoTestSession testSession);
Exemplo n.º 12
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);
				}
			}
Exemplo n.º 13
0
 public override void Replay(AutoTestSession testSession)
 {
     testSession.ExecuteCommand(CommandId);
 }
Exemplo n.º 14
0
		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;
		}
Exemplo n.º 15
0
 public abstract void Replay(AutoTestSession testSession);
Exemplo n.º 16
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;
			});
		}
Exemplo n.º 17
0
			public override void Replay (AutoTestSession testSession)
			{
				testSession.ExecuteCommand (CommandId);
			}
Exemplo n.º 18
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);
				}
			}