OLD | NEW |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 /// <summary> | 94 /// <summary> |
95 /// This is run after each test to clean up things created in TestSetup(). | 95 /// This is run after each test to clean up things created in TestSetup(). |
96 /// </summary> | 96 /// </summary> |
97 [TestCleanup] | 97 [TestCleanup] |
98 public void TestCleanup() | 98 public void TestCleanup() |
99 { | 99 { |
100 TestUtilities.CleanUpVisualStudioInstance(dte_); | 100 TestUtilities.CleanUpVisualStudioInstance(dte_); |
101 } | 101 } |
102 | 102 |
103 /// <summary> | 103 /// <summary> |
104 /// Test method to check that the NaCl platform compiles a test project. | |
105 /// </summary> | |
106 [TestMethod] | |
107 public void CheckNaClCompile() | |
108 { | |
109 string naclPlatform = NativeClientVSAddIn.Strings.NaCl64PlatformName; | |
110 TryCompile(naclSolutionEmptyInitialization, "Debug", naclPlatform); | |
111 TryCompile(naclSolutionEmptyInitialization, "Release", naclPlatform); | |
112 } | |
113 | |
114 | |
115 | |
116 /// <summary> | |
117 /// Test method to check that the NaCl platform compiles a test project. | |
118 /// </summary> | |
119 [TestMethod] | |
120 public void CheckPNaClCompile() | |
121 { | |
122 int revision; | |
123 string root = System.Environment.GetEnvironmentVariable("NACL_SDK_ROOT")
; | |
124 SDKUtilities.GetSDKVersion(root, out revision); | |
125 if (revision < SDKUtilities.MinPNaCLSDKVersion) | |
126 { | |
127 Assert.Inconclusive(); | |
128 } | |
129 string naclPlatform = NativeClientVSAddIn.Strings.PNaClPlatformName; | |
130 TryCompile(naclSolutionEmptyInitialization, "Debug", naclPlatform); | |
131 TryCompile(naclSolutionEmptyInitialization, "Release", naclPlatform); | |
132 } | |
133 | |
134 /// <summary> | |
135 /// Test method to check that the Pepper platform compiles a test project. | |
136 /// </summary> | |
137 [TestMethod] | |
138 public void CheckPepperCompile() | |
139 { | |
140 string pepperPlatform = NativeClientVSAddIn.Strings.PepperPlatformName; | |
141 TryCompile(naclSolutionEmptyInitialization, "Debug", pepperPlatform); | |
142 TryCompile(naclSolutionEmptyInitialization, "Release", pepperPlatform); | |
143 } | |
144 | |
145 /// <summary> | |
146 /// Test method which verifies that NaCl and pepper platforms have correct d
efault properties | 104 /// Test method which verifies that NaCl and pepper platforms have correct d
efault properties |
147 /// when initialized from the Win32 platform. | 105 /// when initialized from the Win32 platform. |
148 /// </summary> | 106 /// </summary> |
149 [TestMethod] | 107 [TestMethod] |
150 public void VerifySettingsWin32Initialization() | 108 public void VerifySettingsWin32Initialization() |
151 { | 109 { |
152 string naclSolutionWin32Initialization = TestUtilities.CreateBlankValidNaC
lSolution( | 110 string naclSolutionWin32Initialization = TestUtilities.CreateBlankValidNaC
lSolution( |
153 dte_, "ProjectSettingsTestWin32Init", "Win32", "Win32", TestContext)
; | 111 dte_, "ProjectSettingsTestWin32Init", "Win32", "Win32", TestContext)
; |
154 VerifyDefaultPepperSettings(naclSolutionWin32Initialization); | 112 VerifyDefaultPepperSettings(naclSolutionWin32Initialization); |
155 VerifyDefaultNaClSettings(naclSolutionWin32Initialization); | 113 VerifyDefaultNaClSettings(naclSolutionWin32Initialization); |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 // C/C++ Advanced | 429 // C/C++ Advanced |
472 AllConfigsAssertPropertyEquals(page, "CompileAs", "Default", true); | 430 AllConfigsAssertPropertyEquals(page, "CompileAs", "Default", true); |
473 | 431 |
474 // Linker Input | 432 // Linker Input |
475 page = "Link"; | 433 page = "Link"; |
476 AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi_cp
p;ppapi", true); | 434 AllConfigsAssertPropertyContains(page, "AdditionalDependencies", "ppapi_cp
p;ppapi", true); |
477 dte_.Solution.Close(); | 435 dte_.Solution.Close(); |
478 } | 436 } |
479 | 437 |
480 /// <summary> | 438 /// <summary> |
481 /// Helper function which opens the given solution, sets the configuration a
nd platform and | |
482 /// tries to compile, failing the test if the build does not succeed. | |
483 /// </summary> | |
484 /// <param name="solutionPath">Path to the solution to open.</param> | |
485 /// <param name="configName">Solution Configuration name (Debug or Release).
</param> | |
486 /// <param name="platformName">Platform name.</param> | |
487 private void TryCompile(string solutionPath, string configName, string platf
ormName) | |
488 { | |
489 string failFormat = "Project compile failed for {0} platform {1} config. B
uild output: {2}"; | |
490 string cygwinWarningFormat = "Did not pass cygwin nodosfilewarning environ
ment var to tools" | |
491 + " Platform: {0}, configuration: {1}"; | |
492 StringComparison ignoreCase = StringComparison.InvariantCultureIgnoreCase; | |
493 | |
494 // Open Debug configuration and build. | |
495 dte_.Solution.Open(solutionPath); | |
496 TestUtilities.SetSolutionConfiguration( | |
497 dte_, TestUtilities.BlankNaClProjectUniqueName, configName, platformNa
me); | |
498 dte_.Solution.SolutionBuild.Build(true); | |
499 | |
500 string compileOutput = TestUtilities.GetPaneText( | |
501 dte_.ToolWindows.OutputWindow.OutputWindowPanes.Item("Build")); | |
502 Assert.IsTrue( | |
503 compileOutput.Contains("Build succeeded.", ignoreCase), | |
504 string.Format(failFormat, platformName, configName, compileOutput)); | |
505 Assert.IsFalse( | |
506 compileOutput.Contains("MS-DOS style path detected", ignoreCase), | |
507 string.Format(cygwinWarningFormat, platformName, configName)); | |
508 | |
509 dte_.Solution.Close(); | |
510 } | |
511 | |
512 /// <summary> | |
513 /// Helper function to reduce repeated code. Opens the given solution and s
ets the debug_ | 439 /// Helper function to reduce repeated code. Opens the given solution and s
ets the debug_ |
514 /// and release_ member variables to point to the given platform type. | 440 /// and release_ member variables to point to the given platform type. |
515 /// </summary> | 441 /// </summary> |
516 /// <param name="solutionPath">Path to the solution to open.</param> | 442 /// <param name="solutionPath">Path to the solution to open.</param> |
517 /// <param name="platformName">Platform type to load.</param> | 443 /// <param name="platformName">Platform type to load.</param> |
518 private void OpenSolutionAndGetProperties(string solutionPath, string platfo
rmName) | 444 private void OpenSolutionAndGetProperties(string solutionPath, string platfo
rmName) |
519 { | 445 { |
520 // Extract the debug and release configurations for Pepper from the projec
t. | 446 // Extract the debug and release configurations for Pepper from the projec
t. |
521 dte_.Solution.Open(solutionPath); | 447 dte_.Solution.Open(solutionPath); |
522 Project project = dte_.Solution.Projects.Item(TestUtilities.BlankNaClProje
ctUniqueName); | 448 Project project = dte_.Solution.Projects.Item(TestUtilities.BlankNaClProje
ctUniqueName); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 debug_, | 521 debug_, |
596 pageName, | 522 pageName, |
597 propertyName); | 523 propertyName); |
598 TestUtilities.AssertPropertyIsNotNullOrEmpty( | 524 TestUtilities.AssertPropertyIsNotNullOrEmpty( |
599 release_, | 525 release_, |
600 pageName, | 526 pageName, |
601 propertyName); | 527 propertyName); |
602 } | 528 } |
603 } | 529 } |
604 } | 530 } |
OLD | NEW |