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

Side by Side Diff: visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs

Issue 14122017: [VS Addin] Add visual studio 2012 support (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.IO; 8 using System.IO;
9 9
10 using EnvDTE; 10 using EnvDTE;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 { 190 {
191 string expectedSDKRootDir = 191 string expectedSDKRootDir =
192 Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariable) ; 192 Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariable) ;
193 Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not se t!"); 193 Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not se t!");
194 expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' }); 194 expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' });
195 195
196 // Set up the property manager to read the NaCl platform settings from Bla nkValidSolution. 196 // Set up the property manager to read the NaCl platform settings from Bla nkValidSolution.
197 PropertyManager target = new PropertyManager(); 197 PropertyManager target = new PropertyManager();
198 dte_.Solution.Open(naclSolution); 198 dte_.Solution.Open(naclSolution);
199 Project naclProject = dte_.Solution.Projects.Item(TestUtilities.NaClProjec tUniqueName); 199 Project naclProject = dte_.Solution.Projects.Item(TestUtilities.NaClProjec tUniqueName);
200 target.SetTarget(naclProject, Strings.NaCl64PlatformName, "Debug");
201 Assert.AreEqual(
202 PropertyManager.ProjectPlatformType.NaCl,
203 target.PlatformType,
204 "SetTarget did not succeed with nacl platform on valid project.");
205 200
206 string slnDir = Path.GetDirectoryName(naclSolution); 201 string slnDir = Path.GetDirectoryName(naclSolution);
207 string projectDir = Path.Combine( 202 string projectDir = Path.Combine(
208 slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\"; 203 slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\";
209 string outputDir = Path.Combine(projectDir, "NaCl64", "newlib", "Debug") + @"\"; 204
210 string assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProjectNa me + "_64.nexe");
211 205
212 Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root."); 206 foreach (string platform in NaClPlatformNames())
213 Assert.AreEqual(projectDir, target.ProjectDirectory, "ProjectDirectory."); 207 {
214 Assert.AreEqual(outputDir, target.OutputDirectory, "OutputDirectory."); 208 target.SetTarget(naclProject, platform, "Debug");
215 Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly."); 209 Assert.AreEqual(
216 Assert.AreEqual( 210 PropertyManager.ProjectPlatformType.NaCl,
217 @"newlib", 211 target.PlatformType,
218 target.GetProperty("ConfigurationGeneral", "ToolchainName"), 212 "SetTarget did not succeed with nacl platform on valid project.");
219 "GetProperty() with ToolchainName incorrect."); 213
214 string outputDir = Path.Combine(projectDir, platform, "newlib", "Debug ") + @"\";
215
216 string assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProje ctName);
217 if (platform == "NaCl64")
218 assembly += "_64.nexe";
219 else if (platform == "NaCl32")
220 assembly += "_32.nexe";
221 else if (platform == "NaClARM")
222 assembly += "_arm.nexe";
223 else if (platform == "PNaCl")
224 assembly += ".pexe";
225 else
226 Assert.Fail();
227
228 Assert.AreEqual(projectDir, target.ProjectDirectory, "ProjectDirectory .");
229 Assert.AreEqual(outputDir, target.OutputDirectory, "OutputDirectory.") ;
230 Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly.");
231 Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root .");
232 Assert.AreEqual(
233 @"newlib",
234 target.GetProperty("ConfigurationGeneral", "ToolchainName"),
235 "GetProperty() with ToolchainName incorrect.");
236 }
220 } 237 }
221 238
222 /// <summary> 239 /// <summary>
223 /// A test for GetProperty. Checks some non-trivial C# properties and the Ge tProperty method. 240 /// A test for GetProperty. Checks some non-trivial C# properties and the Ge tProperty method.
224 /// </summary> 241 /// </summary>
225 [TestMethod] 242 [TestMethod]
226 public void GetPropertyPNaClTest() 243 public void GetPropertyPNaClTest()
227 { 244 {
228 string expectedSDKRootDir = 245 string expectedSDKRootDir =
229 Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariabl e); 246 Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariabl e);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 string newValue = "ThisIsNew"; 307 string newValue = "ThisIsNew";
291 target.SetProperty("ConfigurationGeneral", "VSNaClSDKRoot", newValue); 308 target.SetProperty("ConfigurationGeneral", "VSNaClSDKRoot", newValue);
292 Assert.AreEqual( 309 Assert.AreEqual(
293 newValue, 310 newValue,
294 target.GetProperty("ConfigurationGeneral", "VSNaClSDKRoot"), 311 target.GetProperty("ConfigurationGeneral", "VSNaClSDKRoot"),
295 "SetProperty() did not set property VSNaClSDKRoot."); 312 "SetProperty() did not set property VSNaClSDKRoot.");
296 } 313 }
297 } 314 }
298 } 315 }
299 } 316 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698