mirror of
https://github.com/firebase/firebase-ios-sdk
synced 2026-11-11 22:55:59 +05:45
* Delete GDTCORStoredEvent, modify apis and tests * styled * Delete GDTCORDataFuture * header changes * add writeToURL in COREvent * Remove dataObjectTransportBytes property in COREvent * Set fileURL in COREvent nullable * Change method writeToURL private and modify comments * Modify encoding keys in GDTCORStorage and GDTCORUploadPackage * comments and headers changes * testMigration passed without fileURL * Regression test passed with retrieving fileURL * styled and added fileURL NOTNIL assert in test * Modify backwords compatibility of GDTCORStoredEvent decoding * Comments changes * Add GDTCOREvent translation mapping in UploadPackage
52 lines
2.0 KiB
Objective-C
52 lines
2.0 KiB
Objective-C
/*
|
|
* Copyright 2019 Google
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#import "GDTCORTests/Unit/Helpers/GDTCOREventGenerator.h"
|
|
|
|
#import <GoogleDataTransport/GDTCORClock.h>
|
|
#import <GoogleDataTransport/GDTCOREvent.h>
|
|
|
|
#import "GDTCORLibrary/Private/GDTCOREvent_Private.h"
|
|
#import "GDTCORTests/Unit/Helpers/GDTCORDataObjectTesterClasses.h"
|
|
|
|
@implementation GDTCOREventGenerator
|
|
|
|
+ (NSMutableSet<GDTCOREvent *> *)generate3Events {
|
|
static NSUInteger counter = 0;
|
|
NSString *cachePath = NSTemporaryDirectory();
|
|
NSString *filePath =
|
|
[cachePath stringByAppendingPathComponent:[NSString stringWithFormat:@"test-%ld.txt",
|
|
(unsigned long)counter]];
|
|
int howManyToGenerate = 3;
|
|
NSMutableSet<GDTCOREvent *> *set = [[NSMutableSet alloc] initWithCapacity:howManyToGenerate];
|
|
for (int i = 0; i < howManyToGenerate; i++) {
|
|
GDTCOREvent *event = [[GDTCOREvent alloc] initWithMappingID:@"1337" target:50];
|
|
event.clockSnapshot = [GDTCORClock snapshot];
|
|
event.qosTier = GDTCOREventQosDefault;
|
|
event.dataObject = [[GDTCORDataObjectTesterSimple alloc] initWithString:@"testing!"];
|
|
[[NSFileManager defaultManager] createFileAtPath:filePath
|
|
contents:[NSData data]
|
|
attributes:nil];
|
|
NSError *error = nil;
|
|
[event writeToURL:[NSURL fileURLWithPath:filePath] error:&error];
|
|
[set addObject:event];
|
|
counter++;
|
|
}
|
|
return set;
|
|
}
|
|
|
|
@end
|