/core/externals/update-engine/Core/KSTicketTestBase.h

http://macfuse.googlecode.com/ · C Header · 64 lines · 36 code · 5 blank · 23 comment · 0 complexity · 476fa3d4c519e3601c2847f24246d288 MD5 · raw file

  1. // Copyright 2009 Google Inc.
  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 <SenTestingKit/SenTestingKit.h>
  15. #import "KSOmahaServer.h"
  16. #import "KSTicket.h"
  17. // For many unit tests we'll need a group of tickets, some servers, etc.
  18. // Here's a common base class for that. Since we don't have MI in objc,
  19. // this needs to derive from SenTestCase. Finally, since it derives
  20. // from SenTestCase, otest thinks it's a test, so I added an empty test
  21. // to avoid confusion about the "zero unit tests run" message.
  22. @interface KSTicketTestBase : SenTestCase {
  23. NSURL *fileURL_;
  24. NSURL *httpURL_;
  25. int size_;
  26. NSMutableArray *fileTickets_;
  27. NSMutableArray *httpTickets_;
  28. KSOmahaServer *httpServer_;
  29. }
  30. // Helper to create a KSTicket with the given |url| and |count|.
  31. // |x| is used to make the productID/version unique.
  32. - (KSTicket *)ticketWithURL:(NSURL *)url count:(int)count;
  33. // Helper to make a ticket with a given |url| and |count|, and extra
  34. // bit of information.
  35. - (KSTicket *)ticketWithURL:(NSURL *)url count:(int)count
  36. tttoken:(NSString *)tttoken;
  37. - (KSTicket *)ticketWithURL:(NSURL *)url count:(int)count
  38. creationDate:(NSDate *)creationDate;
  39. - (KSTicket *)ticketWithURL:(NSURL *)url count:(int)count
  40. tag:(NSString *)tag;
  41. - (KSTicket *)ticketWithURL:(NSURL *)url count:(int)count
  42. brandPath:(NSString *)brandPath
  43. brandKey:(NSString *)brandKey;
  44. - (KSTicket *)ticketWithURL:(NSURL *)url count:(int)count
  45. versionPath:(NSString *)versionPath
  46. versionKey:(NSString *)versionKey
  47. version:(NSString *)version;
  48. // Designated enticketizer: Set a bunch of ticket knobs at one time.
  49. - (KSTicket *)ticketWithURL:(NSURL *)url
  50. count:(int)count
  51. tttoken:(NSString *)tttoken
  52. creationDate:(NSDate *)creationDate
  53. tag:(NSString *)tag
  54. brandPath:(NSString *)brandPath
  55. brandKey:(NSString *)brandKey
  56. versionPath:(NSString *)versionPath
  57. versionKey:(NSString *)versionKey
  58. version:(NSString *)version;
  59. @end