| 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 NativeClientVSAddIn | 5 namespace NativeClientVSAddIn |
| 6 { | 6 { |
| 7 using System; | 7 using System; |
| 8 | 8 |
| 9 /// <summary> | 9 /// <summary> |
| 10 /// This class fakes the mechanism for reading and writing properties on prope
rty pages. | 10 /// This class fakes the mechanism for reading and writing properties on prope
rty pages. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 /// <summary> | 24 /// <summary> |
| 25 /// Constructs the property manager. | 25 /// Constructs the property manager. |
| 26 /// </summary> | 26 /// </summary> |
| 27 /// <param name="platformType">The platform type to represent.</param> | 27 /// <param name="platformType">The platform type to represent.</param> |
| 28 /// <param name="getter">Receives property get requests and returns mock val
ues.</param> | 28 /// <param name="getter">Receives property get requests and returns mock val
ues.</param> |
| 29 /// <param name="setter">Receives property set requests and checks them.</pa
ram> | 29 /// <param name="setter">Receives property set requests and checks them.</pa
ram> |
| 30 public MockPropertyManager( | 30 public MockPropertyManager( |
| 31 ProjectPlatformType platformType, PropertyGetter getter, PropertySetter
setter) | 31 ProjectPlatformType platformType, PropertyGetter getter, PropertySetter
setter) |
| 32 { | 32 { |
| 33 this.ProjectPlatform = platformType; | 33 this.PlatformType = platformType; |
| 34 if (platformType == ProjectPlatformType.NaCl) |
| 35 this.PlatformName = Strings.NaCl64PlatformName; |
| 36 else |
| 37 this.PlatformName = Strings.PepperPlatformName; |
| 34 getter_ = getter; | 38 getter_ = getter; |
| 35 setter_ = setter; | 39 setter_ = setter; |
| 36 } | 40 } |
| 37 | 41 |
| 38 /// <summary> | 42 /// <summary> |
| 39 /// Can be used to capture the property requests and return whatever value i
s desired. | 43 /// Can be used to capture the property requests and return whatever value i
s desired. |
| 40 /// If this returns null then the test will throw an error that the property
was unexpected. | 44 /// If this returns null then the test will throw an error that the property
was unexpected. |
| 41 /// </summary> | 45 /// </summary> |
| 42 /// <param name="page">Property page name.</param> | 46 /// <param name="page">Property page name.</param> |
| 43 /// <param name="name">Property name.</param> | 47 /// <param name="name">Property name.</param> |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 public override void SetProperty(string page, string name, string value) | 112 public override void SetProperty(string page, string name, string value) |
| 109 { | 113 { |
| 110 if (!setter_(page, name, value)) | 114 if (!setter_(page, name, value)) |
| 111 { | 115 { |
| 112 throw new Exception(string.Format( | 116 throw new Exception(string.Format( |
| 113 "Property set request was not expected by test! Page {0}, Prop: {1}"
, page, name)); | 117 "Property set request was not expected by test! Page {0}, Prop: {1}"
, page, name)); |
| 114 } | 118 } |
| 115 } | 119 } |
| 116 } | 120 } |
| 117 } | 121 } |
| OLD | NEW |