Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(888)

Unified Diff: visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs

Issue 11266051: Add PNaCl support for VS addin. (Closed) Base URL: http://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: now with tests Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs b/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
index f8cdd916ec68d9d14b41b6443582f2561d57cead..a3cd53b71b19ad1704c8db27a44e467e952188b7 100644
--- a/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
@@ -22,7 +22,7 @@ namespace UnitTests
{
/// <summary>
/// This holds the path to the NaCl solution used in these tests.
- /// The NaCl solution is a valid nacl/pepper plug-in VS solution.
+ /// The NaCl solution is a valid NaCl/pepper plug-in VS solution.
/// It is copied into the testing deployment directory and opened in some tests.
/// Because unit-tests run in any order, the solution should not be written to
/// in any tests.
@@ -129,6 +129,13 @@ namespace UnitTests
target.ProjectPlatform,
"SetTarget did not set 'other' platform on when Win32 platform of valid project.");
+ target.SetTarget(naclProject, Strings.PNaClPlatformName, "Debug");
+ Assert.AreEqual(
+ PropertyManager.ProjectPlatformType.NaCl,
+ target.ProjectPlatform,
+ "SetTarget did not succeed with nacl platform on valid project.");
+ Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root incorrect.");
+
target.SetTarget(naclProject, Strings.PepperPlatformName, "Debug");
Assert.AreEqual(
PropertyManager.ProjectPlatformType.Pepper,
@@ -206,6 +213,43 @@ namespace UnitTests
}
/// <summary>
+ /// A test for GetProperty. Checks some non-trivial C# properties and the GetProperty method.
+ /// </summary>
+ [TestMethod]
+ public void GetPropertyPNaClTest()
+ {
+ string expectedSDKRootDir =
+ Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariable);
+ Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not set!");
+ expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' });
+
+ // Set up the property manager to read the NaCl platform settings from BlankValidSolution.
+ PropertyManager target = new PropertyManager();
+ dte_.Solution.Open(naclSolution);
+ Project naclProject = dte_.Solution.Projects.Item(TestUtilities.BlankNaClProjectUniqueName);
+ target.SetTarget(naclProject, Strings.PNaClPlatformName, "Debug");
+ Assert.AreEqual(
+ PropertyManager.ProjectPlatformType.NaCl,
+ target.ProjectPlatform,
+ "SetTarget did not succeed with nacl platform on valid project.");
+
+ string slnDir = Path.GetDirectoryName(naclSolution);
+ string projectDir = Path.Combine(
+ slnDir, Path.GetDirectoryName(TestUtilities.BlankNaClProjectUniqueName)) + @"\";
+ string outputDir = Path.Combine(projectDir, "PNaCl", "newlib", "Debug") + @"\";
+ string assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProjectName + ".pexe");
+
+ Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root.");
+ Assert.AreEqual(projectDir, target.ProjectDirectory, "ProjectDirectory.");
+ Assert.AreEqual(outputDir, target.OutputDirectory, "OutputDirectory.");
+ Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly.");
+ Assert.AreEqual(
+ @"newlib",
+ target.GetProperty("ConfigurationGeneral", "ToolchainName"),
+ "GetProperty() with ToolchainName incorrect.");
+ }
+
+ /// <summary>
/// A test for SetProperty.
/// </summary>
[TestMethod]

Powered by Google App Engine
This is Rietveld 408576698