FSTLevelDBSpecTests.mm 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "Firestore/Example/Tests/SpecTests/FSTSpecTests.h"
  17. #import "Firestore/Source/Local/FSTLevelDB.h"
  18. #include "Firestore/core/src/firebase/firestore/util/path.h"
  19. #import "Firestore/Example/Tests/Local/FSTPersistenceTestHelpers.h"
  20. #import "Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.h"
  21. using firebase::firestore::util::Path;
  22. NS_ASSUME_NONNULL_BEGIN
  23. /**
  24. * An implementation of FSTSpecTests that uses the LevelDB implementation of local storage.
  25. *
  26. * See the FSTSpecTests class comments for more information about how this works.
  27. */
  28. @interface FSTLevelDBSpecTests : FSTSpecTests
  29. @end
  30. @implementation FSTLevelDBSpecTests {
  31. Path _levelDbDir;
  32. }
  33. - (void)setUpForSpecWithConfig:(NSDictionary *)config {
  34. // Getting a new directory will ensure that it is empty.
  35. _levelDbDir = [FSTPersistenceTestHelpers levelDBDir];
  36. [super setUpForSpecWithConfig:config];
  37. }
  38. /** Overrides -[FSTSpecTests persistence] */
  39. - (id<FSTPersistence>)persistenceWithGCEnabled:(__unused BOOL)GCEnabled {
  40. return [FSTPersistenceTestHelpers levelDBPersistenceWithDir:_levelDbDir];
  41. }
  42. - (BOOL)shouldRunWithTags:(NSArray<NSString *> *)tags {
  43. if ([tags containsObject:kEagerGC]) {
  44. return NO;
  45. }
  46. return [super shouldRunWithTags:tags];
  47. }
  48. @end
  49. NS_ASSUME_NONNULL_END