public void FindAndAttachToNaClPluginTest()
    {
      MockProcessSearcher processResults = new MockProcessSearcher();

      using (PluginDebuggerGDB target = new PluginDebuggerGDB(dte_, properties_))
      {
        PluginDebuggerBase_Accessor targetBase = new PluginDebuggerBase_Accessor(
            new PrivateObject(target, new PrivateType(typeof(PluginDebuggerBase))));
        targetBase.debuggedChromeMainProcess_ = System.Diagnostics.Process.GetCurrentProcess();

        uint currentProcId = (uint)targetBase.debuggedChromeMainProcess_.Id;

        // Target nacl process flag.
        string naclCommandLine = Strings.NaClLoaderFlag;

        // Fake the list of processes on the system.
        processResults.ProcessList.Add(
            new ProcessInfo(
                currentProcId,
                currentProcId,
                string.Empty,
                Strings.NaClDebugFlag,
                Strings.ChromeProcessName));
        processResults.ProcessList.Add(
            new ProcessInfo(1, currentProcId, string.Empty, string.Empty, "MyParentProcess"));
        processResults.ProcessList.Add(
            new ProcessInfo(11, 1, string.Empty, naclCommandLine, Strings.NaClProcessName));

        // This is missing some relevant command line args, should not be attached to.
        processResults.ProcessList.Add(
            new ProcessInfo(13, 1, string.Empty, string.Empty, Strings.NaClProcessName));

        // This doesn't have chrome process as their parent, so they should not be attached to.
        processResults.ProcessList.Add(
            new ProcessInfo(15, 15, string.Empty, naclCommandLine, Strings.NaClProcessName));

        // Set the private value to the mock object (can't use accessor since no valid cast).
        FieldInfo processSearcherField = typeof(PluginDebuggerBase).GetField(
            "processSearcher_",
            BindingFlags.NonPublic | BindingFlags.Instance);
        processSearcherField.SetValue(targetBase.Target, processResults);

        // Test that the correct processes are attached to.
        bool goodNaCl = false;
        var handler = new EventHandler<NativeClientVSAddIn.PluginDebuggerBase.PluginFoundEventArgs>(
          delegate(object unused, NativeClientVSAddIn.PluginDebuggerBase.PluginFoundEventArgs args)
          {
            switch (args.ProcessID)
            {
              case 11:
                if (goodNaCl)
                {
                  Assert.Fail("Should not attach twice to same nacl process");
                }

                goodNaCl = true;
                break;
              case 13:
                Assert.Fail("Should not attach to nacl process with bad args");
                break;
              case 15:
                Assert.Fail("Should not attach to nacl process that is not "
                          + "descendant of Visual Studio");
                break;
              default:
                Assert.Fail("Should not attach to non-pepper/non-nacl process");
                break;
            }
          });

        target.PluginFoundEvent += handler;
        target.FindAndAttachToPlugin(null, null);
        target.PluginFoundEvent -= handler;

        Assert.IsTrue(goodNaCl, "Failed to attach to NaCl process");
      }
    }
    public void PluginDebuggerGDBConstructorTest()
    {
      // Check that a null dte fails.
      try
      {
        PluginDebuggerBase nullDte = new PluginDebuggerGDB(null, properties_);
        Assert.Fail("Using null DTE instance did not throw exception");
      }
      catch (ArgumentNullException)
      {
        // This is expected for a correct implementation.
      }
      catch
      {
        Assert.Fail("Using null DTE instance threw something other than ArgumentNullException");
      }

      // Check that a null PropertyManager fails.
      try
      {
        PluginDebuggerBase nullDte = new PluginDebuggerGDB(dte_, null);
        Assert.Fail("Using null property manager did not throw exception");
      }
      catch (ArgumentNullException)
      {
        // This is expected for a correct implementation.
      }
      catch
      {
        Assert.Fail("Using null property manager threw something other than ArgumentNullException");
      }
    }