Esempio n. 1
0
 public void Start()
 {
     try
     {
         _emulator.Start();
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message + "\n" + ex.StackTrace, ex);
     }
 }
Esempio n. 2
0
    /*Run button also qualifies as the pause button.*/
    private void menu_build_run(object sender, EventArgs e)
    {
        //emulator running?
        if (p_Emulator != null) {
            //resume/suspend
            if (p_Emulator.Suspended) { p_Emulator.Resume(); }
            else { p_Emulator.Suspend(); }

            //update the menu buttons for the run/suspend function
            p_MenuStripRunButton.Image = Icons.GetBitmap(
                "tools." + (p_Emulator.Suspended ? "run" : "pause"),
                16);
            p_DropDownRunButton.Text = (p_Emulator.Suspended ? "Resume" : "Pause");
            p_DropDownRunButton.Image = p_MenuStripRunButton.Image;
            return;
        }

        //build and run
        ICompilerOutput<Solution> output = tryBuild();
        if (output == null) { return; }
        readOnlyMode(true);
        p_Emulator = output.CreateEmulator();
        p_Emulator.Start(16, delegate(string line) { p_OutputWindow.WriteLine(line); });
        Text = p_Title + " (Running)";

        //update the menu buttons
        p_MenuStripRunButton.Image = Icons.GetBitmap("tools.pause",16);
        p_DropDownRunButton.Image = p_MenuStripRunButton.Image;
        p_DropDownRunButton.Text = "Pause";

        //create a timer to automatically set the state to "not running"
        //when the process is closed
        Timer timer = new Timer() {
            Interval = 10,
            Enabled = true
        };
        timer.Tick += delegate(object s, EventArgs a) {
            if (!p_Emulator.Running) {
                p_MenuStripRunButton.Image = Icons.GetBitmap("tools.run", 16);
                p_DropDownRunButton.Image = p_MenuStripRunButton.Image;
                p_DropDownRunButton.Text = "Run";

                p_Emulator = null;
                ((Timer)s).Enabled = false;
                readOnlyMode(false);
                Text = p_Title;
            }
        };
    }
Esempio n. 3
0
 public virtual void Run()
 {
     _emulatorNative.Start();
 }
Esempio n. 4
0
        private static TestResults StartEmulatorAndRunTests(IProgressReporter progressReporter, IAndroidDebugBridgeFactory adbFactory, ILogger logger, IEmulator droidEmulator, RunAndroidTestsOptions options)
        {
            TimeSpan timeout = TimeSpan.FromSeconds(options.EmulatorStartupWaitTimeInSeconds);
            using (droidEmulator)
            {
                progressReporter.ReportStatus("Waiting for emulator to boot.");
                droidEmulator.Start(timeout).Wait();

                var adb = adbFactory.GetAndroidDebugBridge();
               
                var apkPath = options.ApkPath;
                progressReporter.ReportStatus("Installing tests APK package.");
                adb.Install(droidEmulator.Device, apkPath, AdbInstallFlags.ReplaceExistingApplication);                 

                progressReporter.ReportTestsStarted(options.ApkPackageName);
                var testRunner = new AndroidTestRunner(logger, adbFactory, droidEmulator.Device, options.ApkPackageName, options.TestInstrumentationClassPath);
                var testResults = testRunner.RunTests();
                progressReporter.ReportTests(testResults);
                progressReporter.ReportTestsFinished(options.ApkPackageName);
                return testResults;
            }
        }