Пример #1
0
 /// <summary>
 /// Called to check if a process is a valid pepper plugin to attach to.
 /// </summary>
 /// <param name="proc">Contains information about the process in question.</param>
 /// <param name="mainChromeFlags">Flags on the main Chrome process.</param>
 /// <returns>True if we should attach to the process.</returns>
 protected override bool IsPluginProcess(ProcessInfo proc, string mainChromeFlags)
 {
   StringComparison ignoreCase = StringComparison.InvariantCultureIgnoreCase;
   string identifierFlagTarget =
           string.Format(Strings.PepperProcessPluginFlagFormat, pluginAssembly_);
   return proc.Name.Equals(Strings.ChromeProcessName, ignoreCase) &&
          proc.CommandLine.Contains(Strings.ChromeRendererFlag, ignoreCase) &&
          proc.CommandLine.Contains(identifierFlagTarget, ignoreCase);
 }
    public void IsNaClPluginProcessTest()
    {
      PluginDebuggerGDB_Accessor target = new PluginDebuggerGDB_Accessor(dte_, properties_);

      ProcessInfo badProc = new ProcessInfo(
          1, 1, string.Empty, Strings.ChromeRendererFlag, Strings.NaClProcessName);
      ProcessInfo goodProc = new ProcessInfo(
          1, 1, string.Empty, Strings.NaClLoaderFlag, Strings.NaClProcessName);

      string goodMainChromeFlags = Strings.NaClDebugFlag;
      string badMainChromeFlags = string.Format(
          Strings.PepperProcessPluginFlagFormat, target.targetNexe_);

      Assert.IsTrue(target.IsPluginProcess(goodProc, goodMainChromeFlags));
      Assert.IsFalse(target.IsPluginProcess(goodProc, badMainChromeFlags));
      Assert.IsFalse(target.IsPluginProcess(badProc, goodMainChromeFlags));
    }
Пример #3
0
 /// <summary>
 /// Called to check if a process is a valid plugin to attach to.
 /// </summary>
 /// <param name="proc">Contains information about the process in question.</param>
 /// <param name="mainChromeFlags">Flags on the main Chrome process.</param>
 /// <returns>True if we should attach to the process.</returns>
 protected virtual bool IsPluginProcess(ProcessInfo proc, string mainChromeFlags)
 {
   throw new InvalidOperationException();
 }
    public void IsPepperPluginProcessTest()
    {
      PluginDebuggerVS_Accessor target = new PluginDebuggerVS_Accessor(dte_, properties_);

      string identifierFlagTarget =
          string.Format(Strings.PepperProcessPluginFlagFormat, target.pluginAssembly_);
      string goodFlags = string.Concat(Strings.ChromeRendererFlag, ' ', identifierFlagTarget);

      ProcessInfo badProc1 = new ProcessInfo(
          1, 1, string.Empty, goodFlags, Strings.NaClProcessName);
      ProcessInfo badProc2 = new ProcessInfo(
          1, 1, string.Empty, Strings.NaClLoaderFlag, Strings.ChromeProcessName);
      ProcessInfo badProc3 = new ProcessInfo(
          1, 1, string.Empty, Strings.ChromeRendererFlag, Strings.ChromeProcessName);
      ProcessInfo badProc4 = new ProcessInfo(
          1, 1, string.Empty, identifierFlagTarget, Strings.ChromeProcessName);
      ProcessInfo goodProc = new ProcessInfo(
          1, 1, string.Empty, goodFlags, Strings.ChromeProcessName);

      Assert.IsTrue(target.IsPluginProcess(goodProc, string.Empty));
      Assert.IsFalse(target.IsPluginProcess(badProc1, string.Empty));
      Assert.IsFalse(target.IsPluginProcess(badProc2, string.Empty));
      Assert.IsFalse(target.IsPluginProcess(badProc3, string.Empty));
      Assert.IsFalse(target.IsPluginProcess(badProc4, string.Empty));
    }