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

Unified Diff: ios/chrome/browser/ui/snapshots_util_unittest.mm

Issue 862693003: Upstream //ios/chrome/browser/snapshots (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/chrome/browser/ui/snapshots_util.mm ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/ui/snapshots_util_unittest.mm
diff --git a/ios/chrome/browser/ui/snapshots_util_unittest.mm b/ios/chrome/browser/ui/snapshots_util_unittest.mm
deleted file mode 100644
index 71063021b18991b0c5e57a9e9acd4ff4bce929ba..0000000000000000000000000000000000000000
--- a/ios/chrome/browser/ui/snapshots_util_unittest.mm
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "ios/chrome/browser/ui/snapshots_util.h"
-
-#import <Foundation/Foundation.h>
-#import <UIKit/UIKit.h>
-
-#include "base/ios/ios_util.h"
-#include "base/mac/foundation_util.h"
-#include "base/path_service.h"
-#include "base/strings/sys_string_conversions.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-bool RegexMatchesOneSnapshotPath(NSString* regexString) {
- NSRegularExpression* regex =
- [NSRegularExpression regularExpressionWithPattern:regexString
- options:0
- error:NULL];
- std::vector<base::FilePath> snapshotsPaths;
- GetSnapshotsPaths(&snapshotsPaths);
- int numberOfMatches = 0;
- for (const base::FilePath& path : snapshotsPaths) {
- NSString* string =
- [NSString stringWithCString:path.value().c_str()
- encoding:[NSString defaultCStringEncoding]];
- if ([regex numberOfMatchesInString:string
- options:0
- range:NSMakeRange(0, [string length])])
- numberOfMatches++;
- }
- return numberOfMatches == 1;
-}
-
-TEST(SnapshotsUtilTest, TestSnapshotList) {
- NSString* scaleModifier = @"";
- CGFloat scale = [UIScreen mainScreen].scale;
- if (scale > 1) {
- scaleModifier = [NSString stringWithFormat:@"@%.0fx", scale];
- }
- NSString* path = @"Main";
- if (base::ios::IsRunningOnIOS8OrLater()) {
- path = base::SysUTF8ToNSString(base::mac::BaseBundleID());
- }
- NSString* filename = @"UIApplicationAutomaticSnapshotDefault-LandscapeRight";
- NSString* regex = [NSString
- stringWithFormat:@".*/%@/%@%@.png$", path, filename, scaleModifier];
- EXPECT_FALSE(RegexMatchesOneSnapshotPath(@".*"));
- EXPECT_FALSE(RegexMatchesOneSnapshotPath(@"foo"));
- EXPECT_TRUE(RegexMatchesOneSnapshotPath(@".*LandscapeRight.*"));
- EXPECT_TRUE(RegexMatchesOneSnapshotPath(regex));
-}
-
-} // anonymous namespace
« no previous file with comments | « ios/chrome/browser/ui/snapshots_util.mm ('k') | ios/chrome/ios_chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698