Chromium Code Reviews| Index: visual_studio/NativeClientVSAddIn/UnitTests/BaseCompileTest.cs |
| diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs b/visual_studio/NativeClientVSAddIn/UnitTests/BaseCompileTest.cs |
| similarity index 69% |
| copy from visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs |
| copy to visual_studio/NativeClientVSAddIn/UnitTests/BaseCompileTest.cs |
| index cb313d8da2d1f1a702cf909d5fc1d9045dbfc2b1..ab7c58e85cf7cfe1472848ff3716fb31e8815c7c 100644 |
| --- a/visual_studio/NativeClientVSAddIn/UnitTests/CompileTest.cs |
| +++ b/visual_studio/NativeClientVSAddIn/UnitTests/BaseCompileTest.cs |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
|
binji
2013/02/12 00:45:27
apparently, this is not necessary.
Sam Clegg
2013/02/12 01:02:15
But this is a "new" file.
binji
2013/02/12 01:19:05
Ah, fair enough.
|
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| using System; |
| @@ -14,32 +14,31 @@ using NativeClientVSAddIn; |
| namespace UnitTests |
| { |
| [TestClass] |
| - public class CompileTest |
| + public class BaseCompileTest |
| { |
| /// <summary> |
| /// The main visual studio object. |
| /// </summary> |
| - private DTE2 dte_; |
| + protected DTE2 dte_; |
| /// <summary> |
| /// The path to a NaCl solution used in compile tests. |
| /// </summary> |
| - private static string SolutionName_; |
| + protected static string SolutionName_; |
| /// <summary> |
| /// This is run one time before any test methods are called. Here we set-up test-copies of |
| /// new NaCl solutions for use in the tests. |
| /// </summary> |
| /// <param name="testContext">Holds information about the current test run</param> |
| - [ClassInitialize] |
| - public static void ClassSetUp(TestContext testContext) |
| + public static void ClassSetUp(TestContext testContext, string solutionBaseName) |
| { |
| DTE2 dte = TestUtilities.StartVisualStudioInstance(); |
| try |
| { |
| SolutionName_ = TestUtilities.CreateBlankValidNaClSolution( |
| dte, |
| - "CompileTest", |
| + solutionBaseName, |
| Strings.PepperPlatformName, |
| Strings.NaCl64PlatformName, |
| testContext); |
| @@ -51,15 +50,6 @@ namespace UnitTests |
| } |
| /// <summary> |
| - /// This is run after each test to clean up things created in TestSetup(). |
| - /// </summary> |
| - [TestCleanup] |
| - public void ClassTearDown() |
| - { |
| - TestUtilities.CleanUpVisualStudioInstance(dte_); |
| - } |
| - |
| - /// <summary> |
| /// This is run before each test to create test resources. |
| /// </summary> |
| [TestInitialize] |
| @@ -93,7 +83,6 @@ namespace UnitTests |
| StringComparison ignoreCase = StringComparison.InvariantCultureIgnoreCase; |
| // Open Debug configuration and build. |
| - dte_.Solution.Open(SolutionName_); |
|
binji
2013/02/12 00:45:27
not needed?
Sam Clegg
2013/02/12 01:03:40
These tests we opening an closing the project way
|
| TestUtilities.SetSolutionConfiguration( |
| dte_, TestUtilities.NaClProjectUniqueName, configName, platformName); |
| dte_.Solution.SolutionBuild.Build(true); |
| @@ -106,8 +95,6 @@ namespace UnitTests |
| Assert.IsFalse( |
| compileOutput.Contains("MS-DOS style path detected", ignoreCase), |
| string.Format(cygwinWarningFormat, platformName, configName)); |
| - |
| - dte_.Solution.Close(true); |
| } |
| /// <summary> |
| @@ -115,7 +102,6 @@ namespace UnitTests |
| /// </summary> |
| private void SetProjectType(string projectType, string platformName) |
| { |
| - dte_.Solution.Open(SolutionName_); |
| Project project = dte_.Solution.Projects.Item(TestUtilities.NaClProjectUniqueName); |
| VCConfiguration config; |
| IVCRulePropertyStorage rule; |
| @@ -127,57 +113,11 @@ namespace UnitTests |
| config = TestUtilities.GetVCConfiguration(project, "Release", platformName); |
| rule = config.Rules.Item("ConfigurationGeneral"); |
| rule.SetPropertyValue("ConfigurationType", projectType); |
| - dte_.Solution.Close(true); |
| - } |
| - |
| - /// <summary> |
| - /// Test method to check that the NaCl platform compiles a test project. |
| - /// </summary> |
| - [TestMethod] |
| - public void CheckNaCl64Compile() |
| - { |
| - CheckCompile(Strings.NaCl64PlatformName, false); |
| - } |
| - |
| - /// <summary> |
| - /// Test method to check that the NaCl platform compiles a test project. |
| - /// </summary> |
| - [TestMethod] |
| - public void CheckNaClARMCompile() |
| - { |
| - string root = System.Environment.GetEnvironmentVariable("NACL_SDK_ROOT"); |
| - if (!SDKUtilities.SupportsARM(root)) |
| - { |
| - Assert.Inconclusive(); |
| - } |
| - CheckCompile(Strings.NaClARMPlatformName, false); |
| - } |
| - |
| - /// <summary> |
| - /// Test method to check that the Pepper platform compiles a test project. |
| - /// </summary> |
| - [TestMethod] |
| - public void CheckPepperCompile() |
| - { |
| - CheckCompile(Strings.PepperPlatformName, true); |
| } |
| - /// <summary> |
| - /// Test method to check that the NaCl platform compiles a test project. |
| - /// </summary> |
| - [TestMethod] |
| - public void CheckPNaClCompile() |
| - { |
| - string root = System.Environment.GetEnvironmentVariable("NACL_SDK_ROOT"); |
| - if (!SDKUtilities.SupportsPNaCl(root)) |
| - { |
| - Assert.Inconclusive(); |
| - } |
| - CheckCompile(Strings.PNaClPlatformName, false); |
| - } |
| - |
| - private void CheckCompile(string platform, bool dll) |
| + protected void CheckCompile(string platform, bool dll) |
| { |
| + dte_.Solution.Open(SolutionName_); |
| SetProjectType("Executable", platform); |
| TryCompile("Debug", platform); |
| TryCompile("Release", platform); |
| @@ -190,6 +130,7 @@ namespace UnitTests |
| TryCompile("Debug", platform); |
| TryCompile("Release", platform); |
| } |
| + dte_.Solution.Close(true); |
| } |
| } |
| } |