| 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.Collections.Generic; | 8 using System.Collections.Generic; |
| 9 using System.IO; | 9 using System.IO; |
| 10 using System.Reflection; | 10 using System.Reflection; |
| 11 | 11 |
| 12 using EnvDTE80; | 12 using EnvDTE80; |
| 13 using Microsoft.VisualStudio.TestTools.UnitTesting; | 13 using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 14 | 14 |
| 15 using NativeClientVSAddIn; | 15 using NativeClientVSAddIn; |
| 16 | 16 |
| 17 /// <summary> | 17 /// <summary> |
| 18 /// This is a test class for PluginDebuggerGDBTest and is intended | 18 /// This is a test class for PluginDebuggerGDBTest and is intended |
| 19 /// to contain all PluginDebuggerGDB Unit Tests | 19 /// to contain all PluginDebuggerGDB Unit Tests |
| 20 /// </summary> | 20 /// </summary> |
| 21 [TestClass] | 21 [TestClass] |
| 22 public class PluginDebuggerGDBTest | 22 public class PluginDebuggerGDBTest |
| 23 { | 23 { |
| 24 /// <summary> | 24 /// <summary> |
| 25 /// This holds the path to the NaCl solution used in these tests. | 25 /// This holds the path to the NaCl solution used in these tests. |
| 26 /// The NaCl solution is a valid nacl/pepper plug-in VS solution. | 26 /// The NaCl solution is a valid nacl/pepper plug-in VS solution. |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // Validate that the commands contain what we specified. | 290 // Validate that the commands contain what we specified. |
| 291 // The syntax itself is not validated since this add-in is not responsib
le for | 291 // The syntax itself is not validated since this add-in is not responsib
le for |
| 292 // the syntax and it could change. | 292 // the syntax and it could change. |
| 293 Assert.IsTrue( | 293 Assert.IsTrue( |
| 294 gdbCommands.Exists(s => s.Contains(fileName) && s.Contains(lineNumbe
r.ToString())), | 294 gdbCommands.Exists(s => s.Contains(fileName) && s.Contains(lineNumbe
r.ToString())), |
| 295 "Line breakpoint not properly set"); | 295 "Line breakpoint not properly set"); |
| 296 Assert.IsTrue( | 296 Assert.IsTrue( |
| 297 gdbCommands.Exists(s => s.Contains(functionName)), | 297 gdbCommands.Exists(s => s.Contains(functionName)), |
| 298 "Function breakpoint not properly set"); | 298 "Function breakpoint not properly set"); |
| 299 | 299 |
| 300 // Note fake assembly string should be double escaped when passed to gdb
. | 300 // Note fake assembly string should be double escaped when passed to gdb
. |
| 301 Assert.IsTrue( | 301 Assert.IsTrue( |
| 302 gdbCommands.Exists(s => s.Contains(functionName)), | 302 gdbCommands.Exists(s => s.Contains(functionName)), |
| 303 @"fake\\Assembly\\String"); | 303 @"fake\\Assembly\\String"); |
| 304 | 304 |
| 305 // Check that the pre-existing gdb process was killed and its init file
cleaned up. | 305 // Check that the pre-existing gdb process was killed and its init file
cleaned up. |
| 306 Assert.IsFalse( | 306 Assert.IsFalse( |
| 307 TestUtilities.DoesProcessExist("python.exe", existingGDB), | 307 TestUtilities.DoesProcessExist("python.exe", existingGDB), |
| 308 "Failed to kill existing GDB process"); | 308 "Failed to kill existing GDB process"); |
| 309 Assert.IsFalse( | 309 Assert.IsFalse( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 [TestMethod] | 385 [TestMethod] |
| 386 [DeploymentItem("NativeClientVSAddIn.dll")] | 386 [DeploymentItem("NativeClientVSAddIn.dll")] |
| 387 public void IsNaClPluginProcessTest() | 387 public void IsNaClPluginProcessTest() |
| 388 { | 388 { |
| 389 PluginDebuggerGDB_Accessor target = new PluginDebuggerGDB_Accessor(dte_, p
roperties_); | 389 PluginDebuggerGDB_Accessor target = new PluginDebuggerGDB_Accessor(dte_, p
roperties_); |
| 390 | 390 |
| 391 ProcessInfo badProc = new ProcessInfo( | 391 ProcessInfo badProc = new ProcessInfo( |
| 392 1, 1, string.Empty, Strings.ChromeRendererFlag, Strings.NaClProcessNam
e); | 392 1, 1, string.Empty, Strings.ChromeRendererFlag, Strings.NaClProcessNam
e); |
| 393 ProcessInfo goodProc = new ProcessInfo( | 393 ProcessInfo goodProc = new ProcessInfo( |
| 394 1, 1, string.Empty, Strings.NaClLoaderFlag, Strings.NaClProcessName); | 394 1, 1, string.Empty, Strings.NaClLoaderFlag, Strings.NaClProcessName); |
| 395 | 395 |
| 396 string goodMainChromeFlags = Strings.NaClDebugFlag; | 396 string goodMainChromeFlags = Strings.NaClDebugFlag; |
| 397 string badMainChromeFlags = string.Format( | 397 string badMainChromeFlags = string.Format( |
| 398 Strings.PepperProcessPluginFlagFormat, target.targetNexe_); | 398 Strings.PepperProcessPluginFlagFormat, target.targetNexe_); |
| 399 | 399 |
| 400 Assert.IsTrue(target.IsPluginProcess(goodProc, goodMainChromeFlags)); | 400 Assert.IsTrue(target.IsPluginProcess(goodProc, goodMainChromeFlags)); |
| 401 Assert.IsFalse(target.IsPluginProcess(goodProc, badMainChromeFlags)); | 401 Assert.IsFalse(target.IsPluginProcess(goodProc, badMainChromeFlags)); |
| 402 Assert.IsFalse(target.IsPluginProcess(badProc, goodMainChromeFlags)); | 402 Assert.IsFalse(target.IsPluginProcess(badProc, goodMainChromeFlags)); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 } | 405 } |
| OLD | NEW |