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

Side by Side Diff: ios/chrome/app/safe_mode_util_unittest.cc

Issue 1242023005: Remove legacy StartsWithASCII function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: y Created 5 years, 5 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 | « gpu/config/gpu_test_expectations_parser.cc ('k') | ios/chrome/browser/experimental_flags.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <string.h> 5 #include <string.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "ios/chrome/app/safe_mode_util.h" 9 #include "ios/chrome/app/safe_mode_util.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 11 #include "testing/platform_test.h"
12 12
13 using std::string; 13 using std::string;
14 using std::vector; 14 using std::vector;
15 15
16 namespace { 16 namespace {
17 17
18 typedef PlatformTest SafeModeUtilTest; 18 typedef PlatformTest SafeModeUtilTest;
19 19
20 TEST_F(SafeModeUtilTest, GetAllImages) { 20 TEST_F(SafeModeUtilTest, GetAllImages) {
21 vector<string> images = safe_mode_util::GetLoadedImages(nullptr); 21 vector<string> images = safe_mode_util::GetLoadedImages(nullptr);
22 // There should be loaded images. 22 // There should be loaded images.
23 EXPECT_GT(images.size(), 0U); 23 EXPECT_GT(images.size(), 0U);
24 24
25 // The libSystem dylib should always be present. 25 // The libSystem dylib should always be present.
26 bool found_lib_system = false; 26 bool found_lib_system = false;
27 string lib_system_prefix("libSystem"); 27 string lib_system_prefix("libSystem");
28 for (size_t i = 0; i < images.size(); ++i) { 28 for (size_t i = 0; i < images.size(); ++i) {
29 string base_name = base::FilePath(images[i]).BaseName().value(); 29 string base_name = base::FilePath(images[i]).BaseName().value();
30 if (base::StartsWithASCII(base_name, lib_system_prefix, true)) { 30 if (base::StartsWith(base_name, lib_system_prefix,
31 base::CompareCase::SENSITIVE)) {
31 found_lib_system = true; 32 found_lib_system = true;
32 break; 33 break;
33 } 34 }
34 } 35 }
35 EXPECT_TRUE(found_lib_system); 36 EXPECT_TRUE(found_lib_system);
36 } 37 }
37 38
38 TEST_F(SafeModeUtilTest, GetSomeImages) { 39 TEST_F(SafeModeUtilTest, GetSomeImages) {
39 vector<string> all_images = safe_mode_util::GetLoadedImages(nullptr); 40 vector<string> all_images = safe_mode_util::GetLoadedImages(nullptr);
40 vector<string> usr_lib_images = safe_mode_util::GetLoadedImages("/usr/lib/"); 41 vector<string> usr_lib_images = safe_mode_util::GetLoadedImages("/usr/lib/");
41 // There should be images under /usr/lib/, but not all of them are. 42 // There should be images under /usr/lib/, but not all of them are.
42 EXPECT_GT(usr_lib_images.size(), 0U); 43 EXPECT_GT(usr_lib_images.size(), 0U);
43 EXPECT_LT(usr_lib_images.size(), all_images.size()); 44 EXPECT_LT(usr_lib_images.size(), all_images.size());
44 } 45 }
45 46
46 } // namespace 47 } // namespace
OLDNEW
« no previous file with comments | « gpu/config/gpu_test_expectations_parser.cc ('k') | ios/chrome/browser/experimental_flags.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698