Index: experimental/visual_studio_plugin/src/NaClVsx.Package/NaClVsx.Package_UnitTestProject/NaClPackageTestUtils.cs |
diff --git a/experimental/visual_studio_plugin/src/NaClVsx.Package/NaClVsx.Package_UnitTestProject/NaClPackageTestUtils.cs b/experimental/visual_studio_plugin/src/NaClVsx.Package/NaClVsx.Package_UnitTestProject/NaClPackageTestUtils.cs |
deleted file mode 100644 |
index 70ca2dfe0b789e6084ce4b968d65b9383ca9ad49..0000000000000000000000000000000000000000 |
--- a/experimental/visual_studio_plugin/src/NaClVsx.Package/NaClVsx.Package_UnitTestProject/NaClPackageTestUtils.cs |
+++ /dev/null |
@@ -1,159 +0,0 @@ |
-// Copyright (c) 2011 The Native Client Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
- |
-#region |
- |
-using System; |
-using System.IO; |
-using System.Linq; |
-using Google.MsAd7.BaseImpl; |
-using Google.MsAd7.BaseImpl.Interfaces; |
-using Google.NaClVsx.DebugSupport; |
-using Microsoft.VisualStudio.TestTools.UnitTesting; |
- |
-#endregion |
- |
-namespace NaClVsx.Package_UnitTestProject { |
- /// <summary> |
- /// Contains various utilities that are useful for multiple tests. |
- /// </summary> |
- class NaClPackageTestUtils { |
- #region constants |
- |
- /// <summary> |
- /// This points at an empty line inside of a function. |
- /// </summary> |
- public const uint kBlankLineInPrintLoop = 22; |
- |
- /// <summary> |
- /// This is the location at which I is declared in print_line in loop.cc. |
- /// </summary> |
- public const uint kDeclarationOfIRow = 8; |
- |
- /// <summary> |
- /// This is the location at which test_string is declared in void main in loop.cc. |
- /// </summary> |
- public const uint kDeclarationOfTestStringRow = 46; |
- |
- /// <summary> |
- /// This is the call site of the foo function in loop.cc. |
- /// </summary> |
- public const uint kFooCallSiteRow = 49; |
- |
- /// <summary> |
- /// This is the line of the closing paren of the main function in loop.cc. |
- /// </summary> |
- public const uint kMainEndRow = 52; |
- |
- /// <summary> |
- /// This is the first line of the body of the main function in loop.cc. |
- /// </summary> |
- public const uint kMainStartRow = 44; |
- |
- /// <summary> |
- /// This is the location of the printf in print_char_type in loop.cc |
- /// </summary> |
- public const uint kPrintCharTypePrintfRow = 39; |
- |
- /// <summary> |
- /// This is the call site of the print_line function in loop.cc. |
- /// </summary> |
- public const uint kPrintLineCallSiteRow = 24; |
- |
- /// <summary> |
- /// This is a line number somewhere in the print_line function in loop.cc. |
- /// We don't care exactly which one. |
- /// </summary> |
- public const uint kPrintLineRow = 10; |
- |
- /// <summary> |
- /// This is the call site of the print_loop function in loop.cc. |
- /// </summary> |
- public const uint kPrintLoopCallSiteRow = 31; |
- |
- #endregion |
- |
- /// <summary> |
- /// Creates a new NaClSymbolProvider and parses our loop.nexe sample |
- /// binary. |
- /// </summary> |
- /// <returns>The pre-loaded symbol provider.</returns> |
- public static NaClSymbolProvider LoadLoopNexe() { |
- var symbolProvider = new NaClSymbolProvider(null); |
- string status; |
- var ok = symbolProvider.LoadModule( |
- Path.Combine( |
- GetVsxRootDir(), |
- kNexePath), |
- kBaseAddr, |
- out status); |
- Assert.IsTrue(ok, "LoadModule failed"); |
- return symbolProvider; |
- } |
- |
- public static string GetLoopCCPath() { |
- return vsxRootDir + kCCPath; |
- } |
- |
- /// <summary> |
- /// Finds the SDK root, using the system environment. Will fail to assert |
- /// if root cannot be located. |
- /// </summary> |
- /// <returns>The location of the VSX root directory.</returns> |
- public static string GetVsxRootDir() { |
- if (null == vsxRootDir) { |
- vsxRootDir = Environment.GetEnvironmentVariable("NACL_VSX_ROOT"); |
- } |
- Assert.IsNotNull( |
- vsxRootDir, |
- "Could not get NACL_VSX_ROOT from environment."); |
- return vsxRootDir; |
- } |
- |
- public static ulong GetAddressForPosition( |
- string path, uint line, ISimpleSymbolProvider symbolProvider) { |
- var pos = new DocumentPosition(path, line); |
- var addresses = symbolProvider.AddressesFromPosition(pos); |
- Assert.IsNotNull(addresses); |
- Assert.AreEqual(1, addresses.Count()); |
- return addresses.First(); |
- } |
- |
- public static PendingBreakpoint GetPendingBreakpoint() { |
- var sdbMock = new NaClDebuggerMock(); |
- sdbMock.Symbols = new NaClSymbolProvider(sdbMock); |
- var requestMock = new BreakpointRequestMock(); |
- var request = new BreakpointRequest(requestMock); |
- |
- // The instance to test. |
- return new PendingBreakpoint(sdbMock, request); |
- } |
- |
- #region Private Implementation |
- |
- /// <summary> |
- /// The location, relative to |vsxRootDir|, at which the loop.cc source |
- /// is to be found. |
- /// </summary> |
- private static readonly string kCCPath = @"src\loop\loop.cc"; |
- |
- /// <summary> |
- /// The location, relative to |vsxRootDir|, at which the loop.nexe is to |
- /// be found. |
- /// </summary> |
- private static readonly string kNexePath = @"src\loop\loop.nexe"; |
- |
- /// <summary> |
- /// The location of the visual studio plugin code. |
- /// </summary> |
- private static string vsxRootDir; |
- |
- #endregion |
- |
- /// <summary> |
- /// The base address at which symbol information should start in nexe code. |
- /// </summary> |
- public static readonly ulong kBaseAddr = 0x0000000c00000000; |
- } |
-} |