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

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

Issue 10831030: NaCl settings and completed install scripts. (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 8 years, 5 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/ProjectSettingsTest.cs
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/ProjectSettingsTest.cs b/visual_studio/NativeClientVSAddIn/UnitTests/ProjectSettingsTest.cs
index be0b611fc0c88b35f76b1e4232bd245df552739c..8035b53f41ca0527c8d174c967e5c54b076cafbd 100644
--- a/visual_studio/NativeClientVSAddIn/UnitTests/ProjectSettingsTest.cs
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/ProjectSettingsTest.cs
@@ -19,21 +19,13 @@ namespace UnitTests
public class ProjectSettingsTest
{
/// <summary>
- /// The ProjectSettingsTest solution is a valid nacl/pepper plug-in VS solution
- /// that has not had the custom platforms added (PPAPI and NaCl). Immediately
- /// before these unit tests are run the project is copied into the testing
- /// deployment directory, and the custom platforms are added to this copy so that
- /// the project settings are based on the most recent template. Because unit-tests
- /// run in any order, the solution should not be written to in any test.
+ /// This holds the path to the NaCl solution used in these tests.
+ /// 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.
/// </summary>
- private const string ProjectSettingsTestSolution =
- @"\ProjectSettingsTest\ProjectSettingsTest.sln";
-
- /// <summary>
- /// This is the project corresponding to ProjectSettingsTestSolution.
- /// </summary>
- private const string ProjectSettingsTestProject =
- @"ProjectSettingsTest\ProjectSettingsTest.vcxproj";
+ private static string naclSolution;
/// <summary>
/// The main visual studio object.
@@ -57,37 +49,16 @@ namespace UnitTests
public TestContext TestContext { get; set; }
/// <summary>
- /// This is run one time before any test methods are called. Here we set-up the testing copy
- /// of ProjectSettingsTest to use the most up-to-date custom project settings.
+ /// This is run one time before any test methods are called. Here we set-up a test-copy of a
+ /// new NaCl solution for use in the tests.
/// </summary>
/// <param name="testContext">Holds information about the current test run</param>
[ClassInitialize]
public static void ClassSetup(TestContext testContext)
{
- DTE2 dte = null;
- try
- {
- dte = TestUtilities.StartVisualStudioInstance();
- dte.Solution.Open(testContext.DeploymentDirectory + ProjectSettingsTestSolution);
- Project proj = dte.Solution.Projects.Item(ProjectSettingsTestProject);
-
- proj.ConfigurationManager.AddPlatform(
- NativeClientVSAddIn.Strings.PepperPlatformName,
- NativeClientVSAddIn.Strings.PepperPlatformName,
- true);
-
- proj.ConfigurationManager.AddPlatform(
- NativeClientVSAddIn.Strings.NaClPlatformName,
- NativeClientVSAddIn.Strings.NaClPlatformName,
- true);
-
- proj.Save();
- dte.Solution.SaveAs(testContext.DeploymentDirectory + ProjectSettingsTestSolution);
- }
- finally
- {
- TestUtilities.CleanUpVisualStudioInstance(dte);
- }
+ naclSolution = TestUtilities.CreateBlankValidNaClSolution(
+ "ProjectSettingsTest",
+ testContext);
}
/// <summary>
@@ -117,8 +88,8 @@ namespace UnitTests
string page;
// Extract the debug and release configurations for Pepper from the project.
- dte_.Solution.Open(TestContext.DeploymentDirectory + ProjectSettingsTestSolution);
- Project project = dte_.Solution.Projects.Item(ProjectSettingsTestProject);
+ dte_.Solution.Open(naclSolution);
+ Project project = dte_.Solution.Projects.Item(TestUtilities.BlankNaClProjectUniqueName);
Assert.IsNotNull(project, "Testing project was not found");
string pepperPlatform = NativeClientVSAddIn.Strings.PepperPlatformName;
debug_ = TestUtilities.GetVCConfiguration(project, "Debug", pepperPlatform);
@@ -135,10 +106,7 @@ namespace UnitTests
// Debugging
page = "WindowsLocalDebugger";
AllConfigsAssertPropertyEquals(
- page,
- "LocalDebuggerCommand",
- @"$(CHROME_PATH)\chrome.exe",
- true);
+ page, "LocalDebuggerCommand", @"$(CHROME_PATH)\chrome.exe", true);
AllConfigsAssertPropertyEquals(
page,
"LocalDebuggerCommandArguments",
@@ -149,7 +117,8 @@ namespace UnitTests
page = "ConfigurationDirectories";
AllConfigsAssertPropertyContains(page, "IncludePath", @"$(VSNaClSDKRoot)include;", true);
AllConfigsAssertPropertyContains(page, "IncludePath", @"$(VCInstallDir)include", true);
- AllConfigsAssertPropertyContains(page, "LibraryPath", @"$(VSNaClSDKRoot)lib;", true);
+ AllConfigsAssertPropertyContains(
+ page, "LibraryPath", @"$(VSNaClSDKRoot)lib\win_x86_32_host;", true);
AllConfigsAssertPropertyContains(page, "LibraryPath", @"$(VCInstallDir)lib", true);
// C/C++ Code Generation
@@ -162,10 +131,136 @@ namespace UnitTests
false);
TestUtilities.AssertPropertyEquals(release_, page, "RuntimeLibrary", "MultiThreaded", false);
+ // C/C++ Preprocessor
+ AllConfigsAssertPropertyContains(page, "PreprocessorDefinitions", "PPAPI", false);
+
+ // Linker Input
+ page = "Link";
+ AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi_cpp.lib", true);
+ AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi.lib", true);
+ }
+
+ /// <summary>
+ /// Test method to check that the NaCl platform template correctly sets default values.
+ /// </summary>
+ [TestMethod]
+ public void VerifyDefaultNaClSettings()
+ {
+ string page;
+
+ // Extract the debug and release configurations for NaCl from the project.
+ dte_.Solution.Open(naclSolution);
+ Project project = dte_.Solution.Projects.Item(TestUtilities.BlankNaClProjectUniqueName);
+ Assert.IsNotNull(project, "Testing project was not found");
+ string naclPlatform = NativeClientVSAddIn.Strings.NaClPlatformName;
+ debug_ = TestUtilities.GetVCConfiguration(project, "Debug", naclPlatform);
+ release_ = TestUtilities.GetVCConfiguration(project, "Release", naclPlatform);
+
+ // General
+ page = "ConfigurationGeneral";
+ AllConfigsAssertPropertyEquals(page, "OutDir", @"$(ProjectDir)$(ToolchainName)\", true);
+ AllConfigsAssertPropertyEquals(
+ page, "IntDir", @"$(ProjectDir)Intermediate\$(ToolchainName)\", true);
+ AllConfigsAssertPropertyEquals(page, "TargetExt", ".nexe", true);
+ AllConfigsAssertPropertyEquals(page, "ToolchainName", "newlib", true);
+ AllConfigsAssertPropertyEquals(page, "PlatformToolset", "win_x86_$(ToolchainName)", true);
+ AllConfigsAssertPropertyEquals(page, "ConfigurationType", "Application", true);
+ AllConfigsAssertPropertyEquals(page, "TargetArchitecture", "x86_64", true);
+ AllConfigsAssertPropertyEquals(page, "VSNaClSDKRoot", @"$(NACL_SDK_ROOT)\", false);
+
+ // Debugging
+ page = "WindowsLocalDebugger";
+ AllConfigsAssertPropertyEquals(
+ page, "LocalDebuggerCommand", @"$(CHROME_PATH)\chrome.exe", true);
+ AllConfigsAssertPropertyEquals(
+ page, "LocalDebuggerCommandArguments", @"--enable-nacl-debug localhost:5103", true);
+
+ // VC++ Directories
+ page = "ConfigurationDirectories";
+ AllConfigsAssertPropertyContains(page, "IncludePath", @"$(VSNaClSDKRoot)include;", true);
+ AllConfigsAssertPropertyContains(page, "LibraryPath", @"$(VSNaClSDKRoot)lib;", true);
+
+ // C/C++ General
+ page = "CL";
+ TestUtilities.AssertPropertyEquals(
+ debug_,
+ page,
+ "GenerateDebuggingInformation",
+ "true",
+ false);
+ TestUtilities.AssertPropertyEquals(
+ release_,
+ page,
+ "GenerateDebuggingInformation",
+ "false",
+ false);
+
+ AllConfigsAssertPropertyEquals(page, "Warnings", "NormalWarnings", true);
+ AllConfigsAssertPropertyEquals(page, "WarningsAsErrors", "false", true);
+ AllConfigsAssertPropertyEquals(page, "OutputCommandLine", "false", true);
+ AllConfigsAssertPropertyEquals(page, "ConfigurationType", "$(ConfigurationType)", true);
+ AllConfigsAssertPropertyEquals(page, "UserHeaderDependenciesOnly", "true", true);
+
+ // C/C++ Optimization
+ TestUtilities.AssertPropertyEquals(debug_, page, "OptimizationLevel", "O0", false);
+ TestUtilities.AssertPropertyEquals(release_, page, "OptimizationLevel", "O3", false);
+
+ // C/C++ Preprocessor
+ AllConfigsAssertPropertyContains(page, "PreprocessorDefinitions", "NaCl", false);
+
+ // C/C++ Code Generation
+ AllConfigsAssertPropertyEquals(page, "ExceptionHandling", "true", false);
+
+ // C/C++ Output Files
+ AllConfigsAssertPropertyEquals(page, "ObjectFileName", @"$(IntDir)%(FileName).o", false);
+
+ // C/C++ Advanced
+ AllConfigsAssertPropertyEquals(page, "CompileAs", "Default", true);
+
// Linker Input
page = "Link";
- AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi_cpp.lib", false);
- AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi.lib", false);
+ AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi_cpp;ppapi", true);
+ }
+
+ /// <summary>
+ /// Test method to check that the NaCl platform compiles a test project.
+ /// </summary>
+ [TestMethod]
+ public void CheckNaClCompile()
+ {
+ dte_.Solution.Open(naclSolution);
+ TestUtilities.SetSolutionConfiguration(
+ dte_,
+ TestUtilities.BlankNaClProjectUniqueName,
+ "Debug",
+ NativeClientVSAddIn.Strings.NaClPlatformName);
+ dte_.Solution.SolutionBuild.Build(true);
+ string compileOutput = TestUtilities.GetPaneText(
+ dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build"));
+ Assert.IsTrue(
+ compileOutput.Contains("Build succeeded.", StringComparison.InvariantCultureIgnoreCase),
+ "Project compile failed for NaCl platform. Build output: " + compileOutput);
+ }
+
+ /// <summary>
+ /// Test method to check that the Pepper platform compiles a test project.
+ /// </summary>
+ [TestMethod]
+ public void CheckPepperCompile()
+ {
+ dte_.Solution.Open(naclSolution);
+ TestUtilities.SetSolutionConfiguration(
+ dte_,
+ TestUtilities.BlankNaClProjectUniqueName,
+ "Debug",
+ NativeClientVSAddIn.Strings.PepperPlatformName);
+ dte_.Solution.SolutionBuild.Build(true);
+
+ string compileOutput = TestUtilities.GetPaneText(
+ dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build"));
+ Assert.IsTrue(
+ compileOutput.Contains("Build succeeded.", StringComparison.InvariantCultureIgnoreCase),
+ "Project compile failed for Pepper platform. Build output: " + compileOutput);
}
/// <summary>

Powered by Google App Engine
This is Rietveld 408576698