| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import <CoreLocation/CoreLocation.h> | 5 #import <CoreLocation/CoreLocation.h> |
| 6 | 6 |
| 7 #import "ios/chrome/browser/geolocation/CLLocation+XGeoHeader.h" | 7 #import "ios/chrome/browser/geolocation/CLLocation+XGeoHeader.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 11 #error "This file requires ARC support." |
| 12 #endif |
| 13 |
| 10 namespace { | 14 namespace { |
| 11 | 15 |
| 12 NSString* const kEncoded550BatterySt = | 16 NSString* const kEncoded550BatterySt = |
| 13 @"a cm9sZTogQ1VSUkVOVF9MT0NBVElPTgpwcm9kdWNlcjogREVWSUNFX0xPQ0FUSU9OCnRpbWV" | 17 @"a cm9sZTogQ1VSUkVOVF9MT0NBVElPTgpwcm9kdWNlcjogREVWSUNFX0xPQ0FUSU9OCnRpbWV" |
| 14 "zdGFtcDogMTM4OTAwMDAwMDAwMDAwMApyYWRpdXM6IDEwMDAwCmxhdGxuZyA8CiAgbGF0aXR1" | 18 "zdGFtcDogMTM4OTAwMDAwMDAwMDAwMApyYWRpdXM6IDEwMDAwCmxhdGxuZyA8CiAgbGF0aXR1" |
| 15 "ZGVfZTc6IDM3Nzk2MzIyMAogIGxvbmdpdHVkZV9lNzogLTEyMjQwMDI5MTAKPg=="; | 19 "ZGVfZTc6IDM3Nzk2MzIyMAogIGxvbmdpdHVkZV9lNzogLTEyMjQwMDI5MTAKPg=="; |
| 16 | 20 |
| 17 TEST(CLLocationXGeoHeaderTest, TestXGeoString) { | 21 TEST(CLLocationXGeoHeaderTest, TestXGeoString) { |
| 18 CLLocationCoordinate2D coordinate = | 22 CLLocationCoordinate2D coordinate = |
| 19 CLLocationCoordinate2DMake(37.796322, -122.400291); | 23 CLLocationCoordinate2DMake(37.796322, -122.400291); |
| 20 // Picked a fixed timestamp. This one is 2014-01-06 09:20:00 +0000. | 24 // Picked a fixed timestamp. This one is 2014-01-06 09:20:00 +0000. |
| 21 NSDate* timestamp = [NSDate dateWithTimeIntervalSince1970:1389000000]; | 25 NSDate* timestamp = [NSDate dateWithTimeIntervalSince1970:1389000000]; |
| 22 CLLocation* location = | 26 CLLocation* location = [[CLLocation alloc] initWithCoordinate:coordinate |
| 23 [[[CLLocation alloc] initWithCoordinate:coordinate | 27 altitude:0 |
| 24 altitude:0 | 28 horizontalAccuracy:10 |
| 25 horizontalAccuracy:10 | 29 verticalAccuracy:100 |
| 26 verticalAccuracy:100 | 30 course:0 |
| 27 course:0 | 31 speed:0 |
| 28 speed:0 | 32 timestamp:timestamp]; |
| 29 timestamp:timestamp] autorelease]; | |
| 30 NSString* xGeoString = [location cr_xGeoString]; | 33 NSString* xGeoString = [location cr_xGeoString]; |
| 31 EXPECT_TRUE([xGeoString isEqualToString:kEncoded550BatterySt]); | 34 EXPECT_TRUE([xGeoString isEqualToString:kEncoded550BatterySt]); |
| 32 } | 35 } |
| 33 | 36 |
| 34 } // namespace | 37 } // namespace |
| OLD | NEW |