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

Unified Diff: visual_studio/NativeClientVSAddIn/UnitTests/MockProcessSearcher.cs

Issue 10758009: Native Client Visual Studio Add-in (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Style Fixed Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/UnitTests/MockProcessSearcher.cs
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/MockProcessSearcher.cs b/visual_studio/NativeClientVSAddIn/UnitTests/MockProcessSearcher.cs
new file mode 100644
index 0000000000000000000000000000000000000000..86f9b678b82b54263df841aca865844030833a4c
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/MockProcessSearcher.cs
@@ -0,0 +1,61 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace UnitTests
+{
+ /// <summary>
+ /// A fake process searcher that allows the list of 'processes' to be faked
+ /// </summary>
+ public class MockProcessSearcher : NativeClientVSAddIn.IProcessSearcher
+ {
+ /// <summary>
+ /// Constructs the fake process searcher
+ /// </summary>
+ public MockProcessSearcher()
+ {
+ Results = new List<NativeClientVSAddIn.ProcessInfo>();
+ }
+
+ /// <summary>
+ /// This fake version does not use the constraints, but returns it's fake list of
+ /// known processes
+ /// </summary>
+ /// <param name="constraints">Unused</param>
+ /// <returns>Fake list of processes set in Results property</returns>
+ public List<NativeClientVSAddIn.ProcessInfo> GetResults(String constraints)
+ {
+ return Results;
+ }
+
+ /// <summary>
+ /// Searches the fake list of processes for all processes of a given name
+ /// </summary>
+ /// <param name="name">Name to search for</param>
+ /// <returns>List of matching processes</returns>
+ public List<NativeClientVSAddIn.ProcessInfo> GetResultsByName(String name)
+ {
+ return Results.FindAll(proc => name.Equals(proc.Name, StringComparison.OrdinalIgnoreCase));
+ }
+
+ /// <summary>
+ /// Searches the fake list of processes for all processes of a given ID
+ /// </summary>
+ /// <param name="procID">Process ID to search for</param>
+ /// <returns>List of matching processes</returns>
+ public List<NativeClientVSAddIn.ProcessInfo> GetResultsByID(uint procID)
+ {
+ return Results.FindAll(proc => procID == proc.ID);
+ }
+
+ /// <summary>
+ /// Fake list of processes this MockProcessSearcher knows about
+ /// </summary>
+ public List<NativeClientVSAddIn.ProcessInfo> Results { get; set; }
elijahtaylor1 2012/07/11 20:56:18 property naming
tysand 2012/07/12 23:56:15 Done.
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698