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; | |
8 using System.Collections.Generic; | 7 using System.Collections.Generic; |
9 using System.Management; | |
10 | 8 |
11 /// <summary> | 9 /// <summary> |
12 /// A fake process searcher that allows the list of 'processes' on the system
to be faked. | 10 /// A fake process searcher that allows the list of 'processes' on the system
to be faked. |
13 /// </summary> | 11 /// </summary> |
14 public class MockProcessSearcher : NativeClientVSAddIn.ProcessSearcher | 12 public class MockProcessSearcher : NativeClientVSAddIn.ProcessSearcher |
15 { | 13 { |
16 /// <summary> | 14 /// <summary> |
17 /// Constructs the fake process searcher. | 15 /// Constructs the fake process searcher. |
18 /// </summary> | 16 /// </summary> |
19 public MockProcessSearcher() | 17 public MockProcessSearcher() |
20 { | 18 { |
21 this.ProcessList = new List<NativeClientVSAddIn.ProcessInfo>(); | 19 this.ProcessList = new List<NativeClientVSAddIn.ProcessInfo>(); |
22 } | 20 } |
23 | 21 |
24 /// <summary> | 22 /// <summary> |
25 /// Gets or sets the fake list of processes this MockProcessSearcher knows a
bout. | 23 /// Gets or sets the fake list of processes this MockProcessSearcher knows a
bout. |
26 /// </summary> | 24 /// </summary> |
27 public List<NativeClientVSAddIn.ProcessInfo> ProcessList { get; set; } | 25 public List<NativeClientVSAddIn.ProcessInfo> ProcessList { get; set; } |
28 | 26 |
29 /// <summary> | 27 /// <summary> |
30 /// This method substitutes the fake process list for the list of real syste
m processes. | 28 /// This method substitutes the fake process list for the list of real syste
m processes. |
31 /// </summary> | 29 /// </summary> |
32 /// <returns>Fake list of processes</returns> | 30 /// <returns>Fake list of processes</returns> |
33 protected override List<NativeClientVSAddIn.ProcessInfo> GetSystemProcesses(
) | 31 protected override List<NativeClientVSAddIn.ProcessInfo> GetSystemProcesses(
) |
34 { | 32 { |
35 return this.ProcessList; | 33 return this.ProcessList; |
36 } | 34 } |
37 } | 35 } |
38 } | 36 } |
OLD | NEW |