cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / ios / chrome / app / safe_mode_util_unittest.cc
blobc5f1d5b6f5cceecc7c3242a6314e122b78e21360
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
3 // found in the LICENSE file.
5 #include <string.h>
7 #include "base/files/file_path.h"
8 #include "base/strings/string_util.h"
9 #include "ios/chrome/app/safe_mode_util.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h"
13 using std::string;
14 using std::vector;
16 namespace {
18 typedef PlatformTest SafeModeUtilTest;
20 TEST_F(SafeModeUtilTest, GetAllImages) {
21 vector<string> images = safe_mode_util::GetLoadedImages(nullptr);
22 // There should be loaded images.
23 EXPECT_GT(images.size(), 0U);
25 // The libSystem dylib should always be present.
26 bool found_lib_system = false;
27 string lib_system_prefix("libSystem");
28 for (size_t i = 0; i < images.size(); ++i) {
29 string base_name = base::FilePath(images[i]).BaseName().value();
30 if (base::StartsWith(base_name, lib_system_prefix,
31 base::CompareCase::SENSITIVE)) {
32 found_lib_system = true;
33 break;
36 EXPECT_TRUE(found_lib_system);
39 TEST_F(SafeModeUtilTest, GetSomeImages) {
40 vector<string> all_images = safe_mode_util::GetLoadedImages(nullptr);
41 vector<string> usr_lib_images = safe_mode_util::GetLoadedImages("/usr/lib/");
42 // There should be images under /usr/lib/, but not all of them are.
43 EXPECT_GT(usr_lib_images.size(), 0U);
44 EXPECT_LT(usr_lib_images.size(), all_images.size());
47 } // namespace