| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 namespace UnitTests | 5 namespace UnitTests |
| 6 { | 6 { |
| 7 using System; | 7 using System; |
| 8 using System.Diagnostics; | 8 using System.Diagnostics; |
| 9 using System.IO; | 9 using System.IO; |
| 10 using System.Reflection; | 10 using System.Reflection; |
| 11 using System.Threading; | 11 using System.Threading; |
| 12 | 12 |
| 13 using EnvDTE; |
| 13 using EnvDTE80; | 14 using EnvDTE80; |
| 14 using Microsoft.VisualStudio.TestTools.UnitTesting; | 15 using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 15 | 16 |
| 16 using NativeClientVSAddIn; | 17 using NativeClientVSAddIn; |
| 17 | 18 |
| 18 /// <summary> | 19 /// <summary> |
| 19 /// This is a test class for PluginDebuggerHelperTest and is intended | 20 /// This is a test class for PluginDebuggerHelperTest and is intended |
| 20 /// to contain all PluginDebuggerHelperTest Unit Tests. | 21 /// to contain all PluginDebuggerHelperTest Unit Tests. |
| 21 /// </summary> | 22 /// </summary> |
| 22 [TestClass] | 23 [TestClass] |
| 23 public class PluginDebuggerHelperTest | 24 public class PluginDebuggerHelperTest |
| 24 { | 25 { |
| 25 /// <summary> | 26 /// <summary> |
| 26 /// The dummy loop solution is a valid nacl/pepper plug-in VS solution. | 27 /// This holds the path to the NaCl solution used in these tests. |
| 28 /// The NaCl solution is a valid nacl/pepper plug-in VS solution. |
| 27 /// It is copied into the testing deployment directory and opened in some te
sts. | 29 /// It is copied into the testing deployment directory and opened in some te
sts. |
| 28 /// Because unit-tests run in any order, the solution should not be written
to | 30 /// Because unit-tests run in any order, the solution should not be written
to |
| 29 /// in any tests. | 31 /// in any tests. |
| 30 /// </summary> | 32 /// </summary> |
| 31 private const string DummyLoopSolution = @"\DummyLoop\DummyLoop.sln"; | 33 private static string naclSolution; |
| 32 | 34 |
| 33 /// <summary> | 35 /// <summary> |
| 34 /// The main visual studio object. | 36 /// The main visual studio object. |
| 35 /// </summary> | 37 /// </summary> |
| 36 private DTE2 dte_ = null; | 38 private DTE2 dte_; |
| 37 | 39 |
| 38 /// <summary> | 40 /// <summary> |
| 39 /// Gets or sets the test context which provides information about, | 41 /// Gets or sets the test context which provides information about, |
| 40 /// and functionality for the current test run. | 42 /// and functionality for the current test run. |
| 41 /// </summary> | 43 /// </summary> |
| 42 public TestContext TestContext { get; set; } | 44 public TestContext TestContext { get; set; } |
| 43 | 45 |
| 44 /// <summary> | 46 /// <summary> |
| 47 /// This is run one time before any test methods are called. Here we set-up
a test-copy of a |
| 48 /// new NaCl solution for use in the tests. |
| 49 /// </summary> |
| 50 /// <param name="testContext">Holds information about the current test run</
param> |
| 51 [ClassInitialize] |
| 52 public static void ClassSetup(TestContext testContext) |
| 53 { |
| 54 DTE2 dte = TestUtilities.StartVisualStudioInstance(); |
| 55 try |
| 56 { |
| 57 naclSolution = TestUtilities.CreateBlankValidNaClSolution( |
| 58 dte, |
| 59 "PluginDebuggerHelperTest", |
| 60 NativeClientVSAddIn.Strings.PepperPlatformName, |
| 61 NativeClientVSAddIn.Strings.NaClPlatformName, |
| 62 testContext); |
| 63 } |
| 64 finally |
| 65 { |
| 66 TestUtilities.CleanUpVisualStudioInstance(dte); |
| 67 } |
| 68 } |
| 69 |
| 70 /// <summary> |
| 45 /// This is run before each test to create test resources. | 71 /// This is run before each test to create test resources. |
| 46 /// </summary> | 72 /// </summary> |
| 47 [TestInitialize] | 73 [TestInitialize] |
| 48 public void TestSetup() | 74 public void TestSetup() |
| 49 { | 75 { |
| 50 dte_ = TestUtilities.StartVisualStudioInstance(); | 76 dte_ = TestUtilities.StartVisualStudioInstance(); |
| 51 } | 77 } |
| 52 | 78 |
| 53 /// <summary> | 79 /// <summary> |
| 54 /// This is run after each test to clean up things created in TestSetup(). | 80 /// This is run after each test to clean up things created in TestSetup(). |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 target.pluginAssembly_ = "fakeAssemblyString"; | 130 target.pluginAssembly_ = "fakeAssemblyString"; |
| 105 target.irtPath_ = "fakeIrtPath"; | 131 target.irtPath_ = "fakeIrtPath"; |
| 106 target.gdbPath_ = "python.exe"; | 132 target.gdbPath_ = "python.exe"; |
| 107 target.gdbProcess_ = TestUtilities.StartProcessForKilling(existingGDB, 2
0); | 133 target.gdbProcess_ = TestUtilities.StartProcessForKilling(existingGDB, 2
0); |
| 108 string existingInitFileName = Path.GetTempFileName(); | 134 string existingInitFileName = Path.GetTempFileName(); |
| 109 target.gdbInitFileName_ = existingInitFileName; | 135 target.gdbInitFileName_ = existingInitFileName; |
| 110 target.isProperlyInitialized_ = true; | 136 target.isProperlyInitialized_ = true; |
| 111 | 137 |
| 112 // Visual studio won't allow adding a breakpoint unless it is associated
with | 138 // Visual studio won't allow adding a breakpoint unless it is associated
with |
| 113 // an existing file and valid line number, so use DummyLoopSolution. | 139 // an existing file and valid line number, so use DummyLoopSolution. |
| 114 dte_.Solution.Open(TestContext.DeploymentDirectory + DummyLoopSolution); | 140 dte_.Solution.Open(naclSolution); |
| 115 string fileName = "main.cpp"; | 141 string fileName = "main.cpp"; |
| 116 string functionName = "DummyInstance::HandleMessage"; | 142 string functionName = "DummyInstance::HandleMessage"; |
| 117 int lineNumber = 35; | 143 int lineNumber = 35; |
| 118 dte_.Debugger.Breakpoints.Add(Function: functionName); | 144 dte_.Debugger.Breakpoints.Add(Function: functionName); |
| 119 dte_.Debugger.Breakpoints.Add(Line: lineNumber, File: fileName); | 145 dte_.Debugger.Breakpoints.Add(Line: lineNumber, File: fileName); |
| 120 | 146 |
| 121 target.AttachNaClGDB(null, new PluginDebuggerHelper.PluginFoundEventArgs
(0)); | 147 target.AttachNaClGDB(null, new PluginDebuggerHelper.PluginFoundEventArgs
(0)); |
| 122 | 148 |
| 123 Assert.IsTrue(File.Exists(target.gdbInitFileName_), "Init file not writt
en"); | 149 Assert.IsTrue(File.Exists(target.gdbInitFileName_), "Init file not writt
en"); |
| 124 | 150 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 /// A test for FindAndAttachToPlugin. | 205 /// A test for FindAndAttachToPlugin. |
| 180 /// </summary> | 206 /// </summary> |
| 181 [TestMethod] | 207 [TestMethod] |
| 182 [DeploymentItem("NativeClientVSAddIn.dll")] | 208 [DeploymentItem("NativeClientVSAddIn.dll")] |
| 183 public void FindAndAttachToPluginTest() | 209 public void FindAndAttachToPluginTest() |
| 184 { | 210 { |
| 185 PluginDebuggerHelper_Accessor target = new PluginDebuggerHelper_Accessor(d
te_); | 211 PluginDebuggerHelper_Accessor target = new PluginDebuggerHelper_Accessor(d
te_); |
| 186 target.isProperlyInitialized_ = true; | 212 target.isProperlyInitialized_ = true; |
| 187 | 213 |
| 188 MockProcessSearcher processResults = new MockProcessSearcher(); | 214 MockProcessSearcher processResults = new MockProcessSearcher(); |
| 189 uint currentProcId = (uint)System.Diagnostics.Process.GetCurrentProcess().
Id; | 215 target.debuggedChromeMainProcess_ = System.Diagnostics.Process.GetCurrentP
rocess(); |
| 190 string naclCommandLine = Strings.NaClProcessTypeFlag + " " + Strings.NaClD
ebugFlag; | 216 uint currentProcId = (uint)target.debuggedChromeMainProcess_.Id; |
| 217 string naclCommandLine = Strings.NaClLoaderFlag; |
| 218 |
| 191 target.pluginAssembly_ = "testAssemblyPath"; | 219 target.pluginAssembly_ = "testAssemblyPath"; |
| 192 string pluginLoadFlag = string.Format( | 220 string pluginLoadFlag = string.Format( |
| 193 Strings.PepperProcessPluginFlagFormat, target.pluginAssembly_); | 221 Strings.PepperProcessPluginFlagFormat, target.pluginAssembly_); |
| 194 string pepperCommandLine = string.Concat( | 222 string pepperCommandLine = string.Concat( |
| 195 pluginLoadFlag, " ", Strings.PepperProcessTypeFlag); | 223 pluginLoadFlag, " ", Strings.ChromeRendererFlag); |
| 196 string pluginFlagCommandLine = | |
| 197 string.Format(Strings.PepperProcessPluginFlagFormat, target.pluginAsse
mbly_); | |
| 198 | 224 |
| 199 // Fake the list of processes on the system. | 225 // Fake the list of processes on the system. |
| 200 processResults.ProcessList.Add( | 226 processResults.ProcessList.Add( |
| 201 new ProcessInfo(currentProcId, currentProcId, string.Empty, string.Emp
ty, "devenv.exe")); | 227 new ProcessInfo( |
| 228 currentProcId, currentProcId, string.Empty, string.Empty, Strings.
ChromeProcessName)); |
| 202 processResults.ProcessList.Add( | 229 processResults.ProcessList.Add( |
| 203 new ProcessInfo(1, currentProcId, string.Empty, string.Empty, "MyParen
tProcess")); | 230 new ProcessInfo(1, currentProcId, string.Empty, string.Empty, "MyParen
tProcess")); |
| 204 processResults.ProcessList.Add( | 231 processResults.ProcessList.Add( |
| 205 new ProcessInfo(10, 1, string.Empty, pepperCommandLine, Strings.Pepper
ProcessName)); | 232 new ProcessInfo(10, 1, string.Empty, pepperCommandLine, Strings.Chrome
ProcessName)); |
| 206 processResults.ProcessList.Add( | 233 processResults.ProcessList.Add( |
| 207 new ProcessInfo(11, 1, string.Empty, naclCommandLine, Strings.NaClProc
essName)); | 234 new ProcessInfo(11, 1, string.Empty, naclCommandLine, Strings.NaClProc
essName)); |
| 235 |
| 236 // These two are missing some relevant command line args, they should not
be attached to. |
| 208 processResults.ProcessList.Add( | 237 processResults.ProcessList.Add( |
| 209 new ProcessInfo(12, 1, string.Empty, pluginFlagCommandLine, Strings.Pe
pperProcessName)); | 238 new ProcessInfo(12, 1, string.Empty, pluginLoadFlag, Strings.ChromePro
cessName)); |
| 210 processResults.ProcessList.Add( | 239 processResults.ProcessList.Add( |
| 211 new ProcessInfo(13, 1, string.Empty, Strings.NaClDebugFlag, Strings.Na
ClProcessName)); | 240 new ProcessInfo(13, 1, string.Empty, string.Empty, Strings.NaClProcess
Name)); |
| 212 | 241 |
| 213 // These two don't have this process as their parent, so they should not b
e attached to. | 242 // These two don't have this process as their parent, so they should not b
e attached to. |
| 214 processResults.ProcessList.Add( | 243 processResults.ProcessList.Add( |
| 215 new ProcessInfo(14, 14, string.Empty, pepperCommandLine, Strings.Peppe
rProcessName)); | 244 new ProcessInfo(14, 14, string.Empty, pepperCommandLine, Strings.Chrom
eProcessName)); |
| 216 processResults.ProcessList.Add( | 245 processResults.ProcessList.Add( |
| 217 new ProcessInfo(15, 15, string.Empty, naclCommandLine, Strings.NaClPro
cessName)); | 246 new ProcessInfo(15, 15, string.Empty, naclCommandLine, Strings.NaClPro
cessName)); |
| 218 | 247 |
| 219 // Set the private value to the mock object (can't use accessor since no v
alid cast). | 248 // Set the private value to the mock object (can't use accessor since no v
alid cast). |
| 220 typeof(PluginDebuggerHelper).GetField( | 249 typeof(PluginDebuggerHelper).GetField( |
| 221 "processSearcher_", | 250 "processSearcher_", |
| 222 BindingFlags.NonPublic | BindingFlags.Instance).SetValue(target.Target
, processResults); | 251 BindingFlags.NonPublic | BindingFlags.Instance).SetValue(target.Target
, processResults); |
| 223 | 252 |
| 224 // Test that the correct processes are attached to. | 253 // Test that the correct processes are attached to. |
| 225 bool goodNaCl = false; | 254 bool goodNaCl = false; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 try | 331 try |
| 303 { | 332 { |
| 304 target.LoadProjectSettings(); | 333 target.LoadProjectSettings(); |
| 305 Assert.Fail("Initializing with no loaded solution shouldn't succeed"); | 334 Assert.Fail("Initializing with no loaded solution shouldn't succeed"); |
| 306 } | 335 } |
| 307 catch (ArgumentOutOfRangeException) | 336 catch (ArgumentOutOfRangeException) |
| 308 { | 337 { |
| 309 // This is expected for a correct implementation. | 338 // This is expected for a correct implementation. |
| 310 } | 339 } |
| 311 | 340 |
| 312 dte_.Solution.Open(TestContext.DeploymentDirectory + DummyLoopSolution); | 341 dte_.Solution.Open(naclSolution); |
| 313 | 342 |
| 314 // Setting the start-up project to a non-cpp project should make loading f
ail. | 343 // Setting the start-up project to a non-cpp project should make loading f
ail. |
| 315 string badProjectUniqueName = @"NotNaCl\NotNaCl.csproj"; | 344 object[] badStartupProj = { TestUtilities.NotNaClProjectUniqueName }; |
| 316 object[] badStartupProj = { badProjectUniqueName }; | |
| 317 dte_.Solution.SolutionBuild.StartupProjects = badStartupProj; | 345 dte_.Solution.SolutionBuild.StartupProjects = badStartupProj; |
| 318 Assert.IsFalse(target.LoadProjectSettings()); | 346 Assert.IsFalse(target.LoadProjectSettings()); |
| 319 Assert.IsFalse(target.isProperlyInitialized_); | 347 Assert.IsFalse(target.isProperlyInitialized_); |
| 320 | 348 |
| 321 // Setting the start-up project to correct C++ project, but also setting t
he platform | 349 // Setting the start-up project to correct C++ project, but also setting t
he platform |
| 322 // to non-nacl/pepper should make loading fail. | 350 // to non-nacl/pepper should make loading fail. |
| 323 string projectUniqueName = @"DummyLoop\DummyLoop.vcxproj"; | 351 object[] startupProj = { TestUtilities.BlankNaClProjectUniqueName }; |
| 324 object[] startupProj = { projectUniqueName }; | |
| 325 dte_.Solution.SolutionBuild.StartupProjects = startupProj; | 352 dte_.Solution.SolutionBuild.StartupProjects = startupProj; |
| 326 TestUtilities.SetSolutionConfiguration(dte_, projectUniqueName, "Debug", "
Win32"); | 353 TestUtilities.SetSolutionConfiguration( |
| 354 dte_, TestUtilities.BlankNaClProjectUniqueName, "Debug", "Win32"); |
| 327 Assert.IsFalse(target.LoadProjectSettings()); | 355 Assert.IsFalse(target.LoadProjectSettings()); |
| 328 Assert.IsFalse(target.isProperlyInitialized_); | 356 Assert.IsFalse(target.isProperlyInitialized_); |
| 329 | 357 |
| 330 // Setting the platform to NaCl should make loading succeed. | 358 // Setting the platform to NaCl should make loading succeed. |
| 331 TestUtilities.SetSolutionConfiguration( | 359 TestUtilities.SetSolutionConfiguration( |
| 332 dte_, projectUniqueName, "Debug", Strings.NaClPlatformName); | 360 dte_, TestUtilities.BlankNaClProjectUniqueName, "Debug", Strings.NaClP
latformName); |
| 333 Assert.IsTrue(target.LoadProjectSettings()); | 361 Assert.IsTrue(target.LoadProjectSettings()); |
| 334 Assert.IsTrue(target.isProperlyInitialized_); | 362 Assert.IsTrue(target.isProperlyInitialized_); |
| 335 Assert.AreEqual( | 363 Assert.AreEqual( |
| 336 target.projectPlatformType_, | 364 PluginDebuggerHelper_Accessor.ProjectPlatformType.NaCl, |
| 337 PluginDebuggerHelper_Accessor.ProjectPlatformType.NaCl); | 365 target.projectPlatformType_); |
| 338 Assert.AreEqual( | 366 |
| 339 target.pluginProjectDirectory_, | 367 string projectDir = Path.Combine( |
| 340 TestContext.DeploymentDirectory + @"\DummyLoop\DummyLoop\"); | 368 Path.GetDirectoryName(naclSolution), |
| 341 Assert.AreEqual( | 369 Path.GetDirectoryName(TestUtilities.BlankNaClProjectUniqueName)) + @"\
"; |
| 342 target.pluginAssembly_, | 370 string outputDir = Path.Combine(projectDir, "newlib") + @"\"; |
| 343 TestContext.DeploymentDirectory + @"\DummyLoop\DummyLoop\NaCl\Debug\Du
mmyLoop.nexe"); | 371 string assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProjectNa
me + ".nexe"); |
| 344 Assert.AreEqual( | 372 |
| 345 target.pluginOutputDirectory_, | 373 Assert.AreEqual(projectDir, target.pluginProjectDirectory_); |
| 346 TestContext.DeploymentDirectory + @"\DummyLoop\DummyLoop\NaCl\Debug\")
; | 374 Assert.AreEqual(outputDir, target.pluginOutputDirectory_); |
| 347 Assert.AreEqual(target.sdkRootDirectory_, expectedSDKRootDir); | 375 Assert.AreEqual(assembly, target.pluginAssembly_); |
| 348 Assert.AreEqual(target.webServerExecutable_, "python.exe"); | 376 |
| 349 ////Assert.AreEqual(target._webServerArguments, ""); | 377 Assert.AreEqual(expectedSDKRootDir, target.sdkRootDirectory_); |
| 350 ////Assert.AreEqual(target._gdbPath, ""); | 378 Assert.AreEqual("python.exe", target.webServerExecutable_); |
| 351 | 379 |
| 352 // Setting platform to Pepper should make succeed. | 380 // Setting platform to Pepper should make succeed. |
| 353 TestUtilities.SetSolutionConfiguration( | 381 TestUtilities.SetSolutionConfiguration( |
| 354 dte_, projectUniqueName, "Debug", Strings.PepperPlatformName); | 382 dte_, TestUtilities.BlankNaClProjectUniqueName, "Debug", Strings.Peppe
rPlatformName); |
| 355 Assert.IsTrue(target.LoadProjectSettings()); | 383 Assert.IsTrue(target.LoadProjectSettings()); |
| 356 Assert.IsTrue(target.isProperlyInitialized_); | 384 Assert.IsTrue(target.isProperlyInitialized_); |
| 357 Assert.AreEqual( | 385 Assert.AreEqual( |
| 358 target.projectPlatformType_, | 386 PluginDebuggerHelper_Accessor.ProjectPlatformType.Pepper, |
| 359 PluginDebuggerHelper_Accessor.ProjectPlatformType.Pepper); | 387 target.projectPlatformType_); |
| 360 Assert.AreEqual( | 388 |
| 361 target.pluginProjectDirectory_, | 389 outputDir = Path.Combine(projectDir, "win") + @"\"; |
| 362 TestContext.DeploymentDirectory + @"\DummyLoop\DummyLoop\"); | 390 assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProjectName + ".
dll"); |
| 363 Assert.AreEqual( | 391 Assert.AreEqual(projectDir, target.pluginProjectDirectory_); |
| 364 target.pluginAssembly_, | 392 Assert.AreEqual(outputDir, target.pluginOutputDirectory_); |
| 365 TestContext.DeploymentDirectory + @"\DummyLoop\Debug\PPAPI\DummyLoop.d
ll"); | 393 Assert.AreEqual(assembly, target.pluginAssembly_); |
| 366 Assert.AreEqual( | 394 |
| 367 target.pluginOutputDirectory_, | 395 Assert.AreEqual(expectedSDKRootDir, target.sdkRootDirectory_); |
| 368 TestContext.DeploymentDirectory + @"\DummyLoop\Debug\PPAPI\"); | 396 Assert.AreEqual("python.exe", target.webServerExecutable_); |
| 369 Assert.AreEqual(target.sdkRootDirectory_, expectedSDKRootDir); | |
| 370 Assert.AreEqual(target.webServerExecutable_, "python.exe"); | |
| 371 ////Assert.AreEqual(target._webServerArguments, ""); | |
| 372 ////Assert.AreEqual(target._gdbPath, ""); | |
| 373 } | 397 } |
| 374 | 398 |
| 375 /// <summary> | 399 /// <summary> |
| 376 /// Checks that VS properly attaches debugger. | 400 /// Checks that VS properly attaches debugger. |
| 377 /// </summary> | 401 /// </summary> |
| 378 [TestMethod] | 402 [TestMethod] |
| 379 [DeploymentItem("NativeClientVSAddIn.dll")] | 403 [DeploymentItem("NativeClientVSAddIn.dll")] |
| 380 public void AttachVSDebuggerTest() | 404 public void AttachVSDebuggerTest() |
| 381 { | 405 { |
| 382 using (Process dummyProc = TestUtilities.StartProcessForKilling("DummyProc
", 20)) | 406 using (System.Diagnostics.Process dummyProc = TestUtilities.StartProcessFo
rKilling( |
| 407 "DummyProc", 20)) |
| 383 { | 408 { |
| 384 try | 409 try |
| 385 { | 410 { |
| 386 PluginDebuggerHelper_Accessor target = new PluginDebuggerHelper_Access
or(dte_); | 411 PluginDebuggerHelper_Accessor target = new PluginDebuggerHelper_Access
or(dte_); |
| 387 target.projectPlatformType_ = PluginDebuggerHelper_Accessor.ProjectPla
tformType.Pepper; | 412 target.projectPlatformType_ = PluginDebuggerHelper_Accessor.ProjectPla
tformType.Pepper; |
| 388 target.isProperlyInitialized_ = true; | 413 target.isProperlyInitialized_ = true; |
| 389 | 414 |
| 390 target.AttachVSDebugger( | 415 var pluginFoundArgs = new NativeClientVSAddIn.PluginDebuggerHelper.Plu
ginFoundEventArgs( |
| 391 null, | 416 (uint)dummyProc.Id); |
| 392 new NativeClientVSAddIn.PluginDebuggerHelper.PluginFoundEventArgs(
(uint)dummyProc.Id)); | 417 target.AttachVSDebugger(null, pluginFoundArgs); |
| 393 | 418 |
| 394 bool isBeingDebugged = false; | 419 bool isBeingDebugged = false; |
| 395 foreach (EnvDTE.Process proc in dte_.Debugger.DebuggedProcesses) | 420 foreach (EnvDTE.Process proc in dte_.Debugger.DebuggedProcesses) |
| 396 { | 421 { |
| 397 if (proc.ProcessID == dummyProc.Id) | 422 if (proc.ProcessID == dummyProc.Id) |
| 398 { | 423 { |
| 399 isBeingDebugged = true; | 424 isBeingDebugged = true; |
| 400 } | 425 } |
| 401 } | 426 } |
| 402 | 427 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 for (int repeat = 0; repeat < 20; repeat++) | 529 for (int repeat = 0; repeat < 20; repeat++) |
| 505 { | 530 { |
| 506 if (result != null && | 531 if (result != null && |
| 507 result.Contains(successMessage) && | 532 result.Contains(successMessage) && |
| 508 result.Contains(stderrMessage) && | 533 result.Contains(stderrMessage) && |
| 509 result.Contains(TestContext.DeploymentDirectory)) | 534 result.Contains(TestContext.DeploymentDirectory)) |
| 510 { | 535 { |
| 511 break; | 536 break; |
| 512 } | 537 } |
| 513 | 538 |
| 514 Thread.Sleep(500); | 539 System.Threading.Thread.Sleep(500); |
| 515 result = TestUtilities.GetPaneText(target.webServerOutputPane_); | 540 result = TestUtilities.GetPaneText(target.webServerOutputPane_); |
| 516 } | 541 } |
| 517 | 542 |
| 518 Assert.IsFalse(string.IsNullOrEmpty(result), "Nothing printed to output
pane"); | 543 Assert.IsFalse(string.IsNullOrEmpty(result), "Nothing printed to output
pane"); |
| 519 StringAssert.Contains( | 544 StringAssert.Contains( |
| 520 result, | 545 result, |
| 521 successMessage, | 546 successMessage, |
| 522 "Executable did not successfully run given arguments"); | 547 "Executable did not successfully run given arguments"); |
| 523 StringAssert.Contains( | 548 StringAssert.Contains( |
| 524 result, | 549 result, |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 615 |
| 591 // Wait for results to arrive for up to 10 seconds, checking every 0.5 sec
onds. | 616 // Wait for results to arrive for up to 10 seconds, checking every 0.5 sec
onds. |
| 592 for (int repeat = 0; repeat < 20; repeat++) | 617 for (int repeat = 0; repeat < 20; repeat++) |
| 593 { | 618 { |
| 594 if (result != null && | 619 if (result != null && |
| 595 result.Contains(successMessage)) | 620 result.Contains(successMessage)) |
| 596 { | 621 { |
| 597 break; | 622 break; |
| 598 } | 623 } |
| 599 | 624 |
| 600 Thread.Sleep(500); | 625 System.Threading.Thread.Sleep(500); |
| 601 result = TestUtilities.GetPaneText(target.webServerOutputPane_); | 626 result = TestUtilities.GetPaneText(target.webServerOutputPane_); |
| 602 } | 627 } |
| 603 | 628 |
| 604 StringAssert.Contains(result, successMessage, "Message failed to print"); | 629 StringAssert.Contains(result, successMessage, "Message failed to print"); |
| 605 } | 630 } |
| 606 } | 631 } |
| 607 } | 632 } |
| OLD | NEW |