Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: ios/chrome/browser/snapshots/snapshots_util_unittest.mm

Issue 2928423002: [ObjC ARC] Converts ios/chrome/browser/snapshots:unit_tests to ARC. (Closed)
Patch Set: Remove spurious files. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/snapshots/snapshot_cache_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "ios/chrome/browser/snapshots/snapshots_util.h" 5 #import "ios/chrome/browser/snapshots/snapshots_util.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include "base/ios/ios_util.h" 10 #include "base/ios/ios_util.h"
11 #include "base/mac/foundation_util.h" 11 #include "base/mac/foundation_util.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 #if !defined(__has_feature) || !__has_feature(objc_arc)
17 #error "This file requires ARC support."
18 #endif
19
16 namespace { 20 namespace {
17 21
18 bool RegexMatchesOneSnapshotPath(NSString* regexString) { 22 bool RegexMatchesOneSnapshotPath(NSString* regexString) {
19 NSRegularExpression* regex = 23 NSRegularExpression* regex =
20 [NSRegularExpression regularExpressionWithPattern:regexString 24 [NSRegularExpression regularExpressionWithPattern:regexString
21 options:0 25 options:0
22 error:nullptr]; 26 error:nullptr];
23 std::vector<base::FilePath> snapshotsPaths; 27 std::vector<base::FilePath> snapshotsPaths;
24 GetSnapshotsPaths(&snapshotsPaths); 28 GetSnapshotsPaths(&snapshotsPaths);
25 int numberOfMatches = 0; 29 int numberOfMatches = 0;
(...skipping 19 matching lines...) Expand all
45 NSString* filename = @"UIApplicationAutomaticSnapshotDefault-LandscapeRight"; 49 NSString* filename = @"UIApplicationAutomaticSnapshotDefault-LandscapeRight";
46 NSString* regex = [NSString 50 NSString* regex = [NSString
47 stringWithFormat:@".*/%@/%@%@.png$", path, filename, scaleModifier]; 51 stringWithFormat:@".*/%@/%@%@.png$", path, filename, scaleModifier];
48 EXPECT_FALSE(RegexMatchesOneSnapshotPath(@".*")); 52 EXPECT_FALSE(RegexMatchesOneSnapshotPath(@".*"));
49 EXPECT_FALSE(RegexMatchesOneSnapshotPath(@"foo")); 53 EXPECT_FALSE(RegexMatchesOneSnapshotPath(@"foo"));
50 EXPECT_TRUE(RegexMatchesOneSnapshotPath(@".*LandscapeRight.*")); 54 EXPECT_TRUE(RegexMatchesOneSnapshotPath(@".*LandscapeRight.*"));
51 EXPECT_TRUE(RegexMatchesOneSnapshotPath(regex)); 55 EXPECT_TRUE(RegexMatchesOneSnapshotPath(regex));
52 } 56 }
53 57
54 } // anonymous namespace 58 } // anonymous namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/snapshots/snapshot_cache_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698