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

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

Issue 594733002: [VS Addin] Add default compiler include paths to visual studio (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Created 6 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 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 200
201 string slnDir = Path.GetDirectoryName(naclSolution); 201 string slnDir = Path.GetDirectoryName(naclSolution);
202 string projectDir = Path.Combine( 202 string projectDir = Path.Combine(
203 slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\"; 203 slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\";
204
205 204
206 foreach (string platform in NaClPlatformNames()) 205 foreach (string platform in NaClPlatformNames())
207 { 206 {
208 target.SetTarget(naclProject, platform, "Debug"); 207 target.SetTarget(naclProject, platform, "Debug");
209 Assert.AreEqual( 208 Assert.AreEqual(
210 PropertyManager.ProjectPlatformType.NaCl, 209 PropertyManager.ProjectPlatformType.NaCl,
211 target.PlatformType, 210 target.PlatformType,
212 "SetTarget did not succeed with nacl platform on valid project."); 211 "SetTarget did not succeed with nacl platform on valid project.");
213 212
214 string outputDir = Path.Combine(projectDir, platform, "newlib", "Debug ") + @"\"; 213 string outputDir = Path.Combine(projectDir, platform, "newlib", "Debug ") + @"\";
(...skipping 15 matching lines...) Expand all
230 Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly."); 229 Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly.");
231 Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root ."); 230 Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root .");
232 Assert.AreEqual( 231 Assert.AreEqual(
233 @"newlib", 232 @"newlib",
234 target.GetProperty("ConfigurationGeneral", "ToolchainName"), 233 target.GetProperty("ConfigurationGeneral", "ToolchainName"),
235 "GetProperty() with ToolchainName incorrect."); 234 "GetProperty() with ToolchainName incorrect.");
236 } 235 }
237 } 236 }
238 237
239 /// <summary> 238 /// <summary>
240 /// A test for GetProperty. Checks some non-trivial C# properties and the Ge tProperty method.
241 /// </summary>
242 [TestMethod]
243 public void GetPropertyPNaClTest()
244 {
245 string expectedSDKRootDir =
246 Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariabl e);
247 Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not set!");
248 expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' } );
249
250 // Set up the property manager to read the NaCl platform settings from B lankValidSolution.
251 PropertyManager target = new PropertyManager();
252 dte_.Solution.Open(naclSolution);
253 Project naclProject = dte_.Solution.Projects.Item(TestUtilities.NaClProj ectUniqueName);
254 target.SetTarget(naclProject, Strings.PNaClPlatformName, "Debug");
255 Assert.AreEqual(
256 PropertyManager.ProjectPlatformType.NaCl,
257 target.PlatformType,
258 "SetTarget did not succeed with nacl platform on valid project.");
259
260 string slnDir = Path.GetDirectoryName(naclSolution);
261 string projectDir = Path.Combine(
262 slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\";
263 string outputDir = Path.Combine(projectDir, "PNaCl", "newlib", "Debug") + @"\";
264 string assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProject Name + ".pexe");
265
266 Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root." );
267 Assert.AreEqual(projectDir, target.ProjectDirectory, "ProjectDirectory." );
268 Assert.AreEqual(outputDir, target.OutputDirectory, "OutputDirectory.");
269 Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly.");
270 }
271
272 /// <summary>
273 /// Return a list of all nacl platform names. 239 /// Return a list of all nacl platform names.
274 /// </summary> 240 /// </summary>
275 public static string[] NaClPlatformNames() 241 public static string[] NaClPlatformNames()
276 { 242 {
277 return new string[] { Strings.NaCl32PlatformName, Strings.NaCl64Platform Name, 243 return new string[] { Strings.NaCl32PlatformName, Strings.NaCl64Platform Name,
278 Strings.NaClARMPlatformName, Strings.PNaClPlatform Name }; 244 Strings.NaClARMPlatformName, Strings.PNaClPlatform Name };
279 } 245 }
280 246
281 /// <summary> 247 /// <summary>
282 /// A test for SetProperty. 248 /// A test for SetProperty.
(...skipping 24 matching lines...) Expand all
307 string newValue = "ThisIsNew"; 273 string newValue = "ThisIsNew";
308 target.SetProperty("ConfigurationGeneral", "VSNaClSDKRoot", newValue); 274 target.SetProperty("ConfigurationGeneral", "VSNaClSDKRoot", newValue);
309 Assert.AreEqual( 275 Assert.AreEqual(
310 newValue, 276 newValue,
311 target.GetProperty("ConfigurationGeneral", "VSNaClSDKRoot"), 277 target.GetProperty("ConfigurationGeneral", "VSNaClSDKRoot"),
312 "SetProperty() did not set property VSNaClSDKRoot."); 278 "SetProperty() did not set property VSNaClSDKRoot.");
313 } 279 }
314 } 280 }
315 } 281 }
316 } 282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698