forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrome_paths_lacros_unittest.cc
45 lines (39 loc) · 1.64 KB
/
chrome_paths_lacros_unittest.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2020 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.
#include "chrome/common/chrome_paths_internal.h"
#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/test/scoped_path_override.h"
#include "base/test/scoped_running_on_chromeos.h"
#include "chrome/common/chrome_paths.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chrome {
namespace {
TEST(ChromePaths, UserDataDirectoryIsInsideEncryptedPartition) {
// Force paths to behave like they do on device.
base::test::ScopedRunningOnChromeOS running_on_chromeos;
base::FilePath user_data_dir;
ASSERT_TRUE(GetDefaultUserDataDirectory(&user_data_dir));
// The Lacros user data directory contains profile information, including
// credentials. It must be inside the encrypted system user partition.
base::FilePath home_chronos_user("/home/chronos/user");
EXPECT_TRUE(home_chronos_user.IsParent(user_data_dir));
}
TEST(ChromePaths, DownloadsDirectoryRestoredAfterScopedPathOverride) {
base::FilePath original_path;
base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &original_path);
{
// Override with a temp directory.
base::ScopedPathOverride override(chrome::DIR_DEFAULT_DOWNLOADS);
base::FilePath new_path;
base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &new_path);
EXPECT_NE(original_path, new_path);
}
// Original path is restored.
base::FilePath restored_path;
base::PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &restored_path);
EXPECT_EQ(original_path, restored_path);
}
} // namespace
} // namespace chrome