FPRNSURLConnectionInstrumentTestDelegates.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <Foundation/Foundation.h>
  15. NS_ASSUME_NONNULL_BEGIN
  16. /** This class implements only the connectionDidReceiveDataCalled method, because if
  17. * connection:didFinishDownloadingDestinationURL: is implemented, that will always be called.
  18. */
  19. @interface FPRNSURLConnectionDidReceiveDataDelegate : NSObject <NSURLConnectionDataDelegate>
  20. /** Set to YES when connection:didReceiveData: is called, used for testing. */
  21. @property(nonatomic) BOOL connectionDidReceiveDataCalled;
  22. /** Set to YES when connectionDidFinishLoading: is called, used for testing. */
  23. @property(nonatomic) BOOL connectionDidFinishLoadingCalled;
  24. @end
  25. /** This class implements only a couple methods that we care about, and is used for testing. */
  26. @interface FPRNSURLConnectionTestDelegate : NSObject <NSURLConnectionDelegate,
  27. NSURLConnectionDataDelegate,
  28. NSURLConnectionDownloadDelegate>
  29. /** Set to YES when connection:didFailWithError: is called, used for testing. */
  30. @property(nonatomic) BOOL connectionDidFailWithErrorCalled;
  31. /** Set to YES when connection:willSendRequest:redirectResponse: is called, used for testing. */
  32. @property(nonatomic) BOOL connectionWillSendRequestRedirectResponseCalled;
  33. /** Set to YES when connectionDidFinishDownloading:destinationURL: is called, used for testing. */
  34. @property(nonatomic) BOOL connectionDidFinishDownloadingDestinationURLCalled;
  35. @end
  36. /** This class implements only a couple methods that we care about, and is used for testing. */
  37. @interface FPRNSURLConnectionOperationTestDelegate : NSOperation <NSURLConnectionDelegate,
  38. NSURLConnectionDataDelegate,
  39. NSURLConnectionDownloadDelegate>
  40. /** Set to YES when connection:didFailWithError: is called, used for testing. */
  41. @property(nonatomic) BOOL connectionDidFailWithErrorCalled;
  42. /** Set to YES when connection:willSendRequest:redirectResponse: is called, used for testing. */
  43. @property(nonatomic) BOOL connectionWillSendRequestRedirectResponseCalled;
  44. /** Set to YES when connectionDidFinishDownloading:destinationURL: is called, used for testing. */
  45. @property(nonatomic) BOOL connectionDidFinishDownloadingDestinationURLCalled;
  46. @end
  47. /** This class implements only data delegate methods, and is used for testing. */
  48. @interface FPRNSURLConnectionDataTestDelegate
  49. : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate>
  50. /** Set to YES when connectionDidFinishLoading: is called, used for testing. */
  51. @property(nonatomic) BOOL connectionDidFinishLoadingCalled;
  52. @end
  53. /** This class implements only download delegate methods, and is used for testing. */
  54. @interface FPRNSURLConnectionDownloadTestDelegate
  55. : NSObject <NSURLConnectionDelegate, NSURLConnectionDownloadDelegate>
  56. /** Set to YES when connectionDidFinishDownloading:destinationURL: is called, used for testing. */
  57. @property(nonatomic) BOOL connectionDidFinishDownloadingDestinationURLCalled;
  58. @end
  59. /** This class implements every delegate method we care about, and is used for testing. */
  60. @interface FPRNSURLConnectionCompleteTestDelegate : NSObject <NSURLConnectionDelegate,
  61. NSURLConnectionDataDelegate,
  62. NSURLConnectionDownloadDelegate>
  63. /** Set to YES when connection:didFailWithError: is called, used for testing. */
  64. @property(nonatomic) BOOL connectionDidFailWithErrorCalled;
  65. /** Set to YES when connection:willSendRequest:redirectResponse: is called, used for testing. */
  66. @property(nonatomic) BOOL connectionWillSendRequestRedirectResponseCalled;
  67. /** Set to YES when connection:didReceiveResponse: is called, used for testing. */
  68. @property(nonatomic) BOOL connectionDidReceiveResponseCalled;
  69. /** Set to YES when connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite: is
  70. * called. Used for testing.
  71. */
  72. @property(nonatomic) BOOL connectionDidSendBodyDataTotalBytesWrittenTotalBytesExpectedToWriteCalled;
  73. /** Set to YES when connectionDidFinishLoading: is called, used for testing. */
  74. @property(nonatomic) BOOL connectionDidFinishLoadingCalled;
  75. /** Set to YES when connection:didWriteData:totalBytesWritten:expectedTotalBytes: is called, used
  76. * for testing.
  77. */
  78. @property(nonatomic) BOOL connectionDidWriteDataTotalBytesWrittenExpectedTotalBytesCalled;
  79. /** Set to YES when connectionDidFinishDownloading:destinationURL: is called, used for testing. */
  80. @property(nonatomic) BOOL connectionDidFinishDownloadingDestinationURLCalled;
  81. @end
  82. NS_ASSUME_NONNULL_END